How can I switch between the two Java versions in Mountain Lion now that Java Preferences is gone? I have two versions of Java installed with Mountain Lion:


Apple's Java 6 Update 37 (Java for OS X 2012-006)
Oracle's Java 7.


The update from Apple removes Java Preferences. In another question someone wonders about the removal of that utility.

My question is different: 


how can I switch between the two versions now that Java Preferences is gone? 


I previously used Apple's utility to set Java preferences with ease. Without that utility, is there an easy and fast way?
Open up a terminal use this command:

/usr/libexec/java_home -v 1.6 


You can change the 1.6 to any version of java you want to use and the command will output the location of where that version of java resides. (i.e: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home) 

then you can set the JAVA_HOME like you normally would with the output of the previous command. i.e.:

export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home


So to simplify; something like this should work:

export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)


remember to check the version with: 

java -version


Hope it helps.