Vlad's Musings

Tuesday, July 13, 2010

Setting JAVA_HOME in OS X

Setting the JAVA_HOME on the Mac has become a lot easier over the years... Apple introduced the GUI version (Java Preferences) which will let you specify the version of JDK to use. However there are still a number of command line tools that expect (or at least work better with) the JAVA_HOME environment variable, and now Apple has provided a way to do this as well with:


export JAVA_HOME=`/usr/libexec/java_home`

The java_home will print to the standard out the location of the users preferred JDK (as set in Java Preferences) so the above command will nicely tie the two things together.

0 Comments:

Post a Comment

<< Home