How do I change what's returned by /usr/libexec/java_home $ echo $JAVA_HOME 
/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home
$ /usr/libexec/java_home --verbose
Matching Java Virtual Machines (2):
   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

$ ls /Library/Java/JavaVirtualMachines
1.6.0.jdk/
jdk1.7.0_17.jdk/
jdk1.7.0_71.jdk/
jdk1.7.0_80.jdk/
jdk1.8@ -&gt; jdk1.8.0_66.jdk
jdk1.8.0_66.jdk/


How do I get /usr/libexec/java_home to return my Java 1.8 VMs?
The problem here is that Oracle have chnaged the meaning of JRE on Macs.

The Apple and Sun definition is JRE is the runtime for apps and web applets.

Oracle's definition of JRE is for webapps only. This means that it does not change /usr/bin/java

The JDK definition had not changed. Oracle has this at http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html#javasejdk

Oracle does also have a old style JRE that changes /usr/bin/java but have hidden it