I ran this command and got this result:
prem$ /usr/libexec/java_home -v '1.6*'
That directory doesn’t seem to exist according to ls:
prem$ ls /Library/Java/JavaVirtualMachines
./ ../ jdk1.7.0_67.jdk/
However, running the given command to change the JDK actually seemed to work:
prem$ export JAVA_HOME=`/usr/libexec/java_home -v '1.6*'`
prem$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
It’s still pretty mysterious to me how this works.