0 votes
1 view
in Java by (2k points)

Java is an optional package on the latest versions of macOS.

Yet once installed it appears like the JAVA_HOME environment variable is not set properly.

 

1 Answer

0 votes
by (26.9k points)

With the Java elective package or Oracle JDK installed, combining one of the subsequent lines to your ~/.bash_profile file will set the environment variable respectively.

export JAVA_HOME="$(/usr/libexec/java_home -v 1.6)"

or

export JAVA_HOME="$(/usr/libexec/java_home -v 1.7)"

or

export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"

...