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

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap