What should I set JAVA_HOME to on OSX

2019-01-01 14:12发布

Many Java applications that use shell scripts to configure their environment use the JAVA_HOME environment variable to start the correct version of Java, locate JRE JARs, and so on.

On OSX 10.6, the following paths seem to be valid for this variable

/Library/Java/Home
/System/Library/Frameworks/JavaVM.framework/Home
/System/Library/Frameworks/JavaVM.framework/Versions/Current

Some of these are symlinks to the actual current VM (as defined in the Java Preference pane).

But which one should be used—or is it okay to use any of them?

13条回答
回忆,回不去的记忆
2楼-- · 2019-01-01 14:45

For Fish Shell users, use something like the following: alias java7 "set -gx JAVA_HOME (/usr/libexec/java_home -v1.7)"

查看更多
登录 后发表回答