About JAVA_HOME
Mac OS (version 10.13.4)
In Java, that information is stored in folders for each version.
It's annoying to point to the hierarchy / Library / Java / JavaVirtualachine / jdk {version} /
up to that point, so I put it in a variable called JAVA_HOME and handle it easily.
export JAVA_HOME=`directory`
It seems that you can type the command of. The directory is
/usr/libexec/java_home
It can be displayed with a command. This command is
/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java_home
The above hierarchy / Library / Java / JavaVirtualachine / jdk {version} /
is displayed as a shortened system of.
echo $JAVA_HOME
It's okay if you can call it with this command.
When you want to use Java 9
export JAVA_HOME=`/usr/libexec/java_home -v 9`
When you want to use Java 8
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
Do you switch in this way?
Thank you very much JAVA_HOME settings on Mac Learn the meaning of "passing the PATH" by building a Java development environment on Mac
Recommended Posts