Apple made it incredibly difficult to switch JVMs since Mountain Lion. This might make it slightly easier.
-
Download
jvm.sh
to~/bin
-
Create an alias for
jvm.sh
tojvm
in~/.profile
or~/.zshrc
or whateveralias jvm="source ~/bin/jvm.sh"
-
Start a new shell.
-
To see current JVM and list JVMs
jvm
-
To unset JVM
jvm -u
-
To switch JVM
jvm /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home