List the current installed Java versions
$ /usr/libexec/java_home -V
Install the version desired
Apple provides their own version of 6 (Java for OS X 2015-001)
List the current installed Java versions
You should see the version installed
Matching Java Virtual Machines (3):
1.8.0_74, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home
1.6.0_65-b14-468, x86_64: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_65-b14-468, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Select the version
$ export JAVA_HOME=`/usr/libexec/java_home -v 1.6.0_65-b14-468`
Confirm the java version
$ export JAVA_HOME=`/usr/libexec/java_home -v 1.6.0_65-b14-468`
$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)