How can i make java_home tool(ie /usr/libexec/java_home) to work on my mac?I am a mac newbie.Mac Java-home tool says unable to find JVM installed but JVM is installed on my machine and the java -version return true as shown below
$ /usr/libexec/java_home -V
Unable to find any JVMs matching version "(null)".
Matching Java Virtual Machines (0):
Default Java Virtual Machines (0):
No Java runtime present, try --request to install
```$ java -version
openjdk version "11.0.2" 2019-01-15 LTS
OpenJDK Runtime Environment Zulu11.29+3-CA (build 11.0.2+7-LTS)
OpenJDK 64-Bit Server VM Zulu11.29+3-CA (build 11.0.2+7-LTS, mixed mode)
Open up Terminal.app (Applications >> Utilities >> Terminal)
Type: nano .profile
add this to the end of the .profile
file:
JAVA_HOME=/Library/Java/Home
export JAVA_HOME;
Save and exit (ctrl-x and y to confirm)
--- edit
Only now I saw, you are using open jdk, try it:
Before setting the path make sure that java is installed by checking the directory
terminal > type ls /Library/Java/JavaVirtualMachines/
You will see java versions installed
Then in .bash_profile
JAVA_HOME=/Library/Java/JavaVirtualMachines/<version>.jdk/Contents/Home
export JAVA_HOME
terminal type source ~/.bash_profile
to reload
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.