Copy/usr/libexec/java_home -V

lists one line per Java environment installed (and known to the /usr/bin/java command).

You can still have other Java distributions which are not registered. They are typically downloaded as ZIP files without an installer, or using another package manager like homebrew.

Answer from Thorbjørn Ravn Andersen on Stack Overflow
🌐
Codemia
codemia.io › knowledge-hub › path › see_all_the_java_versions_installed_on_mac
See all the Java versions installed on Mac
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises
Discussions

macos - Is there a way to find the complete list of Java versions installed on OS X? - Stack Overflow
I was trying to find the complete list of JDK versions installed on my Mac OS X. I did try with javac -version but it only shows the current version that is set in bashrc. More on stackoverflow.com
🌐 stackoverflow.com
macos - Mac OS X and multiple Java versions - Stack Overflow
NOTE: Sometimes java ends up here: /usr/local/opt/openjdk/bin/java, so you can peek into the "opt" dir and look for "openjdk" in the list with: ... We need to add "/Contents/Home" to the version folder. WARNING: Use the actual paths on your machine... More on stackoverflow.com
🌐 stackoverflow.com
Switching versions of Java on Mac OSX
Not standard, but easier, try using sdkman. More on reddit.com
🌐 r/javahelp
10
1
January 7, 2023
Can I play Minecraft on a Mac? And Apple laptop ?
MacOS can run the Java edition. https://www.minecraft.net/en-us/ More on reddit.com
🌐 r/Minecraft
10
3
May 23, 2019
🌐
Oracle
java.com › en › download › help › version_manual.html
How to find Java version in Windows or Mac - Manual method
Find the Java Control Panel on Windows Find the Java Control Panel on Mac · Under the General tab in the Java Control Panel, the version is available through the About section. A dialog appears (after clicking About) showing the Java version. The latest version(s) of Java on your system will ...
🌐
Mac Install Guide
mac.install.guide › java › version
Check Java Version on Mac · Mac Install Guide · 2026
How to check Java version on Mac with java -version in terminal. Find your JDK location, list all installed Java versions, and solve macOS Java problems.
🌐
Code2care
code2care.org › home › q › how to get list of all java versions installed on macos
How to get list of all Java versions installed on macOS | Code2care
January 26, 2026 - In order to know that versions of Java have been installed on a Mac computer running macOS is to run the command: /usr/libexec/java_home -V
Top answer
1 of 2
17

Mac OS X has a cool binary (/usr/libexec/java_home) that returns the path to a Java home directory from the current user's settings. You may want to issue:

Copy/usr/libexec/java_home -V

It prints the full JVM list with architectures like this:

CopyMatching Java Virtual Machines (2):
    13, x86_64: "OpenJDK 13"    /Library/Java/JavaVirtualMachines/openjdk-13.jdk/Contents/Home
    1.8.0_265, x86_64:  "AdoptOpenJDK 8"    /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/openjdk-13.jdk/Contents/Home

If you want to print the JAVA_HOME path of a specific JDK version, you can do it like this:

Copy/usr/libexec/java_home -v 1.8
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

You can see the complete usage options of below:

CopyUsage: java_home [options...]
    Returns the path to a Java home directory from the current user's settings.

Options:
    [-v/--version   <version>]       Filter Java versions in the "JVMVersion" form 1.X(+ or *).
    [-a/--arch      <architecture>]  Filter JVMs matching architecture (i386, x86_64, etc).
    [-d/--datamodel <datamodel>]     Filter JVMs capable of -d32 or -d64
    [-t/--task      <task>]          Use the JVM list for a specific task (Applets, WebStart, BundledApp, JNI, or CommandLine)
    [-F/--failfast]                  Fail when filters return no JVMs, do not continue with default.
    [   --exec      <command> ...]   Execute the $JAVA_HOME/bin/<command> with the remaining arguments.
    [-R/--request]                   Request installation of a Java Runtime if not installed.
    [-X/--xml]                       Print full JVM list and additional data as XML plist.
    [-V/--verbose]                   Print full JVM list with architectures.
    [-h/--help]                      This usage information.
2 of 2
3

You can use the java_home binary for this task.

/usr/libexec includes internal binaries that are not intended to be executed directly by users or shell scripts. java_home is one such binary, calling it with option -V will print full JVM list with architectures.

Copy     /usr/libexec/java_home -V
Find elsewhere
🌐
Delft Stack
delftstack.com › home › howto › java › check java version mac
How to Check Java Version in Mac | Delft Stack
March 11, 2025 - This command provides information about the installed Java versions on your Mac. Here’s how to use it: Open the Terminal application. ... Matching Java Virtual Machines (1): 17.0.1, x86_64: "Java SE 17.0.1" /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home · The output will list all the installed versions of Java on your Mac.
🌐
Rbind
justinbagley.rbind.io › 2020 › 01 › 05 › how-to-check-java-version-on-mac
How to check Java version and JDK version on Mac - blog
January 5, 2020 - This one is the easiest option for most users that like using the traditional, visual approach to computing on macOS. Simply open System Preferences (“Apple > System Preferences”), and then click “Java” (you will see the Java icon). The Java preferences open in a separate window, called ...
🌐
Tata Neu
tataneu.com › home › consumer electronics › mac java version checklist: quick steps to verify
Mac Java Version Checklist: Quick Steps to Verify
May 5, 2025 - The simplest way to check java version mac terminal is to open the Terminal application on your Mac. Enter the command java -version and review the output. This mac java version command will display the version installed.
🌐
Coderwall
coderwall.com › p › g7kkba › get-the-list-of-all-jvm-on-your-mac
Get the list of all JVM on your Mac (Example)
December 29, 2022 - OSX comes with an handy cli tool ... current Java installation home path. Just type the following command on your terminal shell: ... It prints the home path of your JVM. Even more interestingly specifying the option -V, it shows the list of all the JVMs installed on your system along their home path. This nice tool has other useful options, like filtering the JVM by version or architecture, ...
Top answer
1 of 16
649

The cleanest way to manage multiple java versions on Mac is to use Homebrew.

And within Homebrew, use:

  • homebrew-cask to install the versions of java
  • jenv to manage the installed versions of java

As seen on http://hanxue-it.blogspot.ch/2014/05/installing-java-8-managing-multiple.html , these are the steps to follow.

  1. install homebrew
  2. install homebrew jenv
  3. install homebrew-cask
  4. install a specific java version using cask (see "homebrew-cask versions" paragraph below)
  5. add this version for jenv to manage it
  6. check the version is correctly managed by jenv
  7. repeat steps 4 to 6 for each version of java you need

homebrew-cask versions

Add the homebrew/cask-versions tap to homebrew using:

Copybrew tap homebrew/cask-versions

Then you can look at all the versions available by searching for Eclipse temurin, more details here

Copybrew search temurin

Then you can install the version(s) you like, though version 7 no longer shows up in homebrew via these casks:

Copybrew install --cask temurin8
brew install --cask temurin9

And add them to be managed by jenv as usual.

Copyjenv add <javaVersionPathHere>

I think this is the cleanest & simplest way to go about it.


Another important thing to note, as mentioned in Mac OS X 10.6.7 Java Path Current JDK confusing :

For different types of JDKs or installations, you will have different paths

You can check the paths of the versions installed using /usr/libexec/java_home -V, see How do I check if the Java JDK is installed on Mac?

On Mac OS X Mavericks, I found as following:

  1. Built-in JRE default: /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

  2. JDKs downloaded from Apple: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/

  3. JDKs downloaded from Oracle: /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home


Resources

  • Removing Java 8 JDK from Mac
  • http://hanxue-it.blogspot.ch/2014/05/installing-java-8-managing-multiple.html
  • http://sourabhbajaj.com/mac-setup/index.html
  • http://brew.sh
  • https://github.com/Homebrew/homebrew/tree/master/share/doc/homebrew#readme
  • http://sourabhbajaj.com/mac-setup/Homebrew/README.html
  • "brew tap” explained https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/brew-tap.md
  • “brew versions” explained Homebrew install specific version of formula? and also https://github.com/Homebrew/homebrew-versions
  • https://github.com/caskroom/homebrew-cask
  • “cask versions”, similar to “brew versions”, see https://github.com/caskroom/homebrew-versions and also https://github.com/caskroom/homebrew-cask/issues/9447
  • http://www.jenv.be
  • https://github.com/gcuisinier/jenv
2 of 16
445

Uninstall jdk8, install jdk7, then reinstall jdk8.

My approach to switching between them (in .profile) :

Copyexport JAVA_7_HOME=$(/usr/libexec/java_home -v1.7)
export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8)
export JAVA_9_HOME=$(/usr/libexec/java_home -v9)
export JAVA_20_HOME=$(/usr/libexec/java_home -v20)

alias java7='export JAVA_HOME=$JAVA_7_HOME'
alias java8='export JAVA_HOME=$JAVA_8_HOME'
alias java9='export JAVA_HOME=$JAVA_9_HOME'
alias java20='export JAVA_HOME=$JAVA_20_HOME'

#default java8
export JAVA_HOME=$JAVA_8_HOME

Then you can simply type java7 or java8 in a terminal to switch versions.

(edit: updated to add Dylans improvement for Java 9)

🌐
CodingTechRoom
codingtechroom.com › question › list-installed-java-versions-mac
How to List All Installed Java Versions on a Mac - CodingTechRoom
Open the Terminal application on your Mac. Type the following command: `/usr/libexec/java_home -V | grep -E 'JDK|JRE'` and press Enter. This will display all installed versions of the Java Development Kit (JDK) and Java Runtime Environment (JRE).
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to check java version on mac
How to Check Java Version on Mac (2 Simple Options)
December 16, 2025 - A system running macOS. Access to the command line. Java installed. Finding the installed Java version on macOS requires using the command line. Java versions 10 and earlier also included the Java Control Panel GUI applet, which displayed the installed version in a graphical interface.
🌐
Snyk
snyk.io › blog › installing-and-managing-java-on-macos
Installing and managing Java on macOS | Snyk
October 12, 2023 - Manually installing Java on macOS gives us more control and greater insight into the process than more automated methods. ... Java Downloads page, where you’ll find various Java versions and their specific features. This page also includes a Java Archive section for finding specific older versions.
🌐
Medium
medium.com › @annurahar › manage-various-java-versions-on-mac-osx-e6aee82c882c
Manage various Java versions on Mac OSX | by Annu Rahar | Medium
September 16, 2021 - Manage various Java versions on Mac OSX There are few options to do the installation as well as manage JDK switching. Installation can be done by Homebrew, SDKMAN, Jabba, or a manual install …
🌐
Blogger
puneetlamba.blogspot.com › 2020 › 04 › managing-multiple-java-versions-on-mac.html
Managing Multiple Java Versions on Mac
June 27, 2020 - /usr/libexec/java_home -V This will list out all of your Java versions. Use this information to set up the environment variables as shown above. The above command will also tell you the exact install location for each Java version so that you ...