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:

  1. Nice explanation on setting default Java on Mac—very helpful for beginners managing multiple Java versions. Setting the JAVA_HOME correctly really helps avoid compatibility issues while running applications.
    along with expert care from the
    best urology hospital in Raipur.

    ReplyDelete