#Java version switching on #OS X

If you have to deal with several projects that are based on different versions of Java here is how I’m solving this.

Recently I found out built-in OS X capabilities to switch between different version of Java installed on your system. After some period of time using it I come up with aliases to easily switch between Java versions installed on my machine, here are they:

alias j6='export JAVA_HOME="`/usr/libexec/java_home -v 1.6`"'
alias j7='export JAVA_HOME="`/usr/libexec/java_home -v 1.7`"'
alias j8='export JAVA_HOME="`/usr/libexec/java_home -v 1.8`"'
alias j9='export JAVA_HOME="`/usr/libexec/java_home -v 1.9`"'

Leave a Reply

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