

The tool can do some other stuff too and the manual page is clear and concise. If that’s a bit wordy for you you can do the same thing by specifying the data model (bits) too: ➜ ~ /usr/libexec/java_home -d 32 ➜ ~ /usr/libexec/java_home -d 64 You can also do some cool stuff like filter by cpu architecture: ➜ ~ /usr/libexec/java_home -a i386 ➜ ~ /usr/libexec/java_home -a x86_64

I have omitted the JDK paths for brevity.

You can also ask it to list all of your JDKs too by using the -V argument. ➜ ~ /usr/libexec/java_home /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home The simplest usage of the tool will return the default JDK, which in my case is update 131 of JDK 1.8. OS X has had a very useful utility, since 2003, that allows you to easily generate a path to a JDK.
