Apple announced to remove Java Preferences app from Mac OS X http://support.apple.com/kb/HT5493. Let’s try to fix it. Generally, java applications will use the JAVA_HOME environment variable to pick a JDK.
To set to JDK 6
export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)
To set JDK 7
export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
To set JDK 8
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Created aliases for my zsh
alias setjdk16='export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)'
alias setjdk17='export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)'
alias setjdk18='export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)'
You can also read Managing Multiple Java Versions on Mac using Jenv