Switching easily between Java JDKs on Mac OS X

I just came upon a neat little trick to easily switch what JDK you are using on the command line on Mac OS X (10.9.2 is the version I am using), courtesy of this AskDifferent answer. First, add the following aliases in ~/.profile file: alias setJdk6=’export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)’alias setJdk7=’export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)’alias setJdk8=’export JAVA_HOME=$(/usr/libexec/java_home…