It seems that this should be correct.
#You can get the appropriate path automatically.
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Until now, it was a full path direct writing. (And the link was broken)
#This is a bad example.
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
If you don't have JDK yet, download it from the Oracle download site and install it.
Open ~ / .bash_profile
in an editor and add ```export JAVA_HOME = ... ``.
$ vi ~/.bash_profile
...
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Reopen Terminal.app or reload ~ / .bash_profile
with the following command.
$ source ~/.bash_profile
Make sure you have set it up as you intended.
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Recommended Posts