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.
javamacos
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.
Best Answer
With the Java optional package or Oracle JDK installed, adding one of the following lines to your ~/.bash_profile file will set the environment variable accordingly.
Note: If you installed openjdk on mac using brew, run
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
for the above to workUpdate: added -v flag based on Jilles van Gurp response.