0 votes
1 view
in Java by (3.9k 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 (46.1k 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)"

Related questions

0 votes
1 answer
asked Jul 18, 2019 in Java by Shubham (3.9k points)
0 votes
1 answer
0 votes
1 answer
asked Jul 10, 2019 in Java by Krishna (2.6k points)
0 votes
1 answer
asked Jul 10, 2019 in Java by Anvi (10.2k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...