When an application or plug-in install states that the JAVA_HOME variable point you my JDK, 开发者_StackOverflow中文版what export statement do I need to put in my .bash_profile?
The proper way to set JAVA_HOME is to invoke the java_home(1)
tool (see http://developer.apple.com/library/mac/#qa/qa1170/_index.html). This can be done as follows to use defaults:
export JAVA_HOME=$(/usr/libexec/java_home)
Browse to: /System/Library/Frameworks/JavaVM.Framework/Versions/
Then, pick an alias to a version or 'CurrentJDK'.
export JAVA_HOME=/System/Library/Frameworks/JavaVM.Framework/Versions/CurrentJDK/Home
then add $JAVA_HOME to your PATH.
I agree with Valko Sipuli.
I'm using Mac OS Yosemite and
JAVA_HOME=$(/usr/libexec/java_home)
did the trick for running ant.
精彩评论