Easy way to change Java version on Mac OSX

Edit your .bash_profile and add the line:

#For Java 7:

export JAVA_HOME="`/usr/libexec/java_home -v '1.7*'`"

#For Java 8:

export JAVA_HOME="`/usr/libexec/java_home -v '1.8*'`"

Leave a Reply

Your email address will not be published. Required fields are marked *