macOS / binaries /

java_home

/usr/libexec/java_home
Return a value for $java_home

The java_home command returns a path suitable for setting the JAVA_HOME environment variable. It determines this path from the user's preferred JVM based on configured environment variables. Additional constraints may be provided to filter the list of JVMs available.

source: man