Monday, September 2, 2013

Setting default java on a mac

If you have multiple versions of Java on your Mac, you can set the current working version from the command line as follows:

export JAVA_HOME=`/usr/libexec/java_home -v1.6`

This will set the version to 1.6.  You can of course see the current version with

java -version

You can see all java versions installed on your mac with:

/usr/libexec/java_home -V

(tested with macos 10.8.4 )

1 comment: