How to find Java HOME in Mac Terminal

In order to know the Java HOME Path on your Mac, you can execute the java_home command-line utility available on macOS under /usr/libexec/

Code2care@Mac % /usr/libexec/java_home 


As you can see that my Java HOME is set to be that of OpenJDK-20 (i.e. Java JDK 20)

Java HOME Path Mac Terminal Command

Using this path you can get into the bin folder and have access to the path of all java related executable files.

 Code2care@Mac % cd bin

 Code2care@Mac % ls

jar		jcmd		jhsdb		jpackage	jstatd
jarsigner	jconsole	jimage		jps		jwebserver
java		jdb		jinfo		jrunscript	keytool
javac		jdeprscan	jlink		jshell		rmiregistry
javadoc		jdeps		jmap		jstack		serialver
javap		jfr		jmod		jstat

Have Questions? Post them here!