3

I have set java_home on my mac, by putting export JAVA_HOME=/System/Library/Frameworks/JavaVM.frameworks/Home to my ~/.profile file. I quit the terminal and ran it again.

But when I typed echo $JAVA_HOME and pressed Enter it shows JAVA_HOME=/System/Library/Frameworks/JavaVM.frameworks/Version/1.6.0_22/Home which is not the right one. How can I fix this problem & change this ?

1
  • What Mac OS X version are you using? Try navigating to /System/Library/Frameworks/JavaVM.frameworks/ and open Home to see if it's an alias. Command-click the folder name in the title bar to see the full path. If it's /System/Library/Frameworks/JavaVM.frameworks/Version/1.6.0_22/Home, the alias was simply resolved.
    – Daniel Beck
    Feb 1, 2011 at 9:25

1 Answer 1

2

Since 10.6 (I think -- may be earlier), the recommended way of setting the JAVA_HOME variable is using /usr/libexec/java_home, via something like

% export JAVA_HOME=`/usr/libexec/java_home`

There are various options you can add to the command to select a suitable JAVA_HOME given various constraints. See the java_home manpage for details.

The general idea is that the structure under /System/Library/Frameworks/JavaVM.frameworks isn't documented and may in principle change from release to release.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .