Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

share|improve this question
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 '11 at 9:25

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.