Mac OSX Switch Java Version


/usr/libexec/java_home -V

this will list all the Java Versions on the machine

select the specific version using:

export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_125`

or just specify the major number

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

Now run

java -version

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s