Java VMs should be installed in either /Library/Java/JavaVirtualMachines
or ~/Library/Java/JavaVirtualMachines
. Not sure where JREs go, but really, who cares?
The java_home
tool is extremely useful, but is not located in the path 🙁 (/usr/libexec/java_home
).
java_home
shows the default JVM.java_home -V
lists all installed JVMs.java_home -v 11
lists all installed Java 11 JVMs.java_home --exec <command>
runs <command> with the default JVM (use -v
for a specific version — if there is more than one, it uses the first returned).