Use multiple JDK at the same time in OS X (Switch JAVA_HOME)

Sometime you need to switch between jdk versions according to projects requirements. It is hard to change JAVA_HOME each time for a specific project, so instead of setting up JAVA_HOME per project we can write a bash script to switch between versions.


export JAVA_HOME=$(/usr/libexec/java_home)

this is the normal JAVA_HOME export which is default set up preferred by mac OSX .


/usr/libexec/java_home -V

above command lists installed java versions which are also seen via Java Preferences menu inside the System properties of Mac.

Continue reading “Use multiple JDK at the same time in OS X (Switch JAVA_HOME)”