๐ŸŒ
Oracle
java.com โ€บ en โ€บ download โ€บ help โ€บ version_manual.html
How to find Java version in Windows or Mac - Manual method
The Add/Remove control panel displays a list of software on your system, including any Java versions that are on your computer. ... The Java Runtime (JRE) that you download from java.com or oracle.com contains a plugin to run Java content from your browser. In order to use the command line tools, you will need to download the Java Development Kit (JDK). The JRE and JDK are separate and can coexist on your system. Only one JRE can be installed on Mac.
๐ŸŒ
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 - 1. Open Spotlight Search by pressing Command + Space on the keyboard. 2. Type Terminal and open it by selecting the relevant search result. ... The output displays the Java version installed on macOS.
Discussions

macos - How do I check if the Java JDK is installed on Mac? - Stack Overflow
this doesn't show any sdk path; only shows java runtime version for me on macOS 12.1, is it because I didn't install the sdk? 2022-03-19T02:56:56.12Z+00:00 ... To show the path where the java jdk installed, use command "which javac". 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
macos - See all the Java versions installed on Mac - Stack Overflow
How can I get all the Java versions installed on my Mac? Is there a terminal command for this? When I run java -version, I get the current JRE version that is in use in my system, but I want to lis... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Where is Java installed on MacOS?
My understanding is that the real executable is in Library directory. /use/bin/javac is simply using the the one in Library. To verify it, you can try to delete the Java virtual machine directory. More on reddit.com
๐ŸŒ r/MacOS
2
3
November 30, 2022
๐ŸŒ
Wikihow
wikihow.com โ€บ computers and electronics โ€บ software โ€บ programming โ€บ java โ€บ how to check java version on a mac: 2 simple methods
How to Quickly and Easily Check Java Version on a Mac
September 28, 2025 - To check the Java version on your Mac, open System Settings and select the "Java" menu item. You can open a terminal and type the command java -version to see your Java version.
Top answer
1 of 11
293

javac -version in a terminal will do

2 of 11
115

You can leverage the java_home helper binary on OS X for what you're looking for.

To list all versions of installed JDK:

$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    1.8.0_51, x86_64:   "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home
    1.7.0_79, x86_64:   "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home

To request the JAVA_HOME path of a specific JDK version, you can do:

$ /usr/libexec/java_home -v 1.7
/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home

$ /usr/libexec/java_home -v 1.8
/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home

You could take advantage of the above commands in your script like this:

REQUESTED_JAVA_VERSION="1.7"
if POSSIBLE_JAVA_HOME="$(/usr/libexec/java_home -v $REQUESTED_JAVA_VERSION 2>/dev/null)"; then
    # Do this if you want to export JAVA_HOME
    export JAVA_HOME="$POSSIBLE_JAVA_HOME"
    echo "Java SDK is installed"
else
    echo "Did not find any installed JDK for version $REQUESTED_JAVA_VERSION"
fi

You might be able to do if-else and check for multiple different versions of java as well.

If you prefer XML output, java_home also has a -X option to output in XML.

$ /usr/libexec/java_home --help
Usage: 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.
๐ŸŒ
Mac Install Guide
mac.install.guide โ€บ java โ€บ version
Check Java Version on Mac ยท Mac Install Guide ยท 2026
The java -version command displays three lines of information. ... This shows the Java version (25.0.1), the release date (October 21, 2025), and whether it's an LTS (Long-Term Support) release.
๐ŸŒ
HubSpot
blog.hubspot.com โ€บ home โ€บ website โ€บ how to check your java version in windows & mac
How to Check Your Java Version in Windows & Mac
February 27, 2025 - From here, you enter the same command as in Windows, java -version to get your current version details. Worth noting? On both Windows and Mac devices, you can use the command javac -version to check the version of your primary Java compiler.
๐ŸŒ
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 - Simply open a shell interpreter (command line interface) such as the Terminal application, and type ... The Java executable on your local machine will output the appropriate Java versioning information.
Find elsewhere
๐ŸŒ
Uprightlabs
help.uprightlabs.com โ€บ en-us โ€บ lister โ€บ how-to-check-java-version-in-windows-or-mac
How to Check Java Version in Windows or Mac
A new window with the terminal should appear on your desktop. In it, type the command java -version and hit Enter on your keyboard ยท The output should display the Java version installed on your Mac system โ€‹Note: This should say OpenJDK version 11.x
๐ŸŒ
Linux Hint
linuxhint.com โ€บ check-java-version-mac
How to Check Java Version on Mac โ€“ Linux Hint
While checking Java version through CLI you may encounter the following error: To use the Java command line tool, JDK needs to be installed. Java is the run time environment also known as JRE and can only be used to run Java based applications whereas JDK is Java Development Kit used to develop and run Java applications. Many applications on Mac ...
๐ŸŒ
Princeton CS
introcs.cs.princeton.edu โ€บ java โ€บ 15inout โ€บ mac-cmd.html
Java and the Mac OS X Terminal
You should see something similar to the information printed below. The important part is that it says 1.6 or 1.5 (and not 1.4). machine:~ wayne$ java -version java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425) Java HotSpot(TM) 64-Bit Server VM (build ...
๐ŸŒ
Delft Stack
delftstack.com โ€บ home โ€บ howto โ€บ java โ€บ change java version mac
How to Change Java Version in MacOS | Delft Stack
February 2, 2024 - Now, we get the current default Java version used in the mac. We use the command java with -version that returns the version of the default JDK.
๐ŸŒ
javaspring
javaspring.net โ€บ blog โ€บ how-to-check-java-version-in-mac
How to Check Java Version in Mac โ€” javaspring.net
If you are a Java developer and want to check the version of the Java compiler, you can use the javac -version command. This is useful when you need to ensure that the compiler version is compatible with your development requirements.
๐ŸŒ
Delft Stack
delftstack.com โ€บ home โ€บ howto โ€บ java โ€บ check java version mac
How to Check Java Version in Mac | Delft Stack
March 11, 2025 - The output will list all the installed versions of Java on your Mac. It provides the version number along with the architecture and installation path. This command is particularly useful if you have multiple versions of Java installed and need to manage them effectively.
๐ŸŒ
javaspring
javaspring.net โ€บ blog โ€บ see-all-the-java-versions-installed-on-mac
How to See All Java Versions Installed on Mac: Terminal Command to List JREs โ€” javaspring.net
Knowing how to list all Java versions on your Mac is essential for development, troubleshooting, and ensuring application compatibility. The usr/libexec/java_home -V command is your go-to tool for a comprehensive list, while checking ...
๐ŸŒ
Medium
medium.com โ€บ @devkosal โ€บ switching-java-jdk-versions-on-macos-80bc868e686a
Switching Java (JDK) Versions on MacOS | by Dev Sharma | Medium
January 10, 2025 - 5. (Optional) To make this the default JDK version, input one of the following in Terminal: # if running zsh which is what recent macs use, open this file open ~/.zshrc# if have an older mac which doesn't use zsh, open this file open ~/.bash_profile ยท Then, add your Terminal input from step 3 to the end of this file: # SWITCH TO JAVA VERSION 8 export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
๐ŸŒ
Oracle
docs.oracle.com โ€บ javase โ€บ 9 โ€บ install โ€บ installation-jdk-and-jre-macos.htm
8 Installation of the JDK and the JRE on macOS
When you start a Java application by clicking a JNLP file, or through the browser, it uses the installed JRE. Only one JRE can be installed. See Determining the JRE Version Installed on macOS. When you run a Java application from the command line, it uses the default JDK.
๐ŸŒ
Quora
quora.com โ€บ How-do-I-check-if-Java-is-installed-on-Mac
How to check if Java is installed on Mac - Quora
Answer (1 of 9): In the Terminal, type โ€œ[code ]java -version[/code]โ€ and press Return. Hopefully you get something like this: > java version "1.8.0_261" Java(TM) SE Runtime Environment (build 1.8.0_261-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode) But if itโ€™s not ...
๐ŸŒ
DEV Community
dev.to โ€บ rithvik78 โ€บ change-the-default-java-version-on-macos-3jee
Change the default Java Version on macOS - DEV Community
February 19, 2022 - Here, We are trying to change the version to Java SE 8 First run /usr/libexec/java_home -V which... Tagged with macos, java, jdk, javase8.