To check your Java version on a Mac, open Terminal, type java -version, and press Return. The output identifies the Java selected in that Terminal session, including its runtime and build information. If you need to check another installation or an app's runtime, use the matching check below.
The short version
- Start in Terminal: Run
java -versionto check the Java selected in your current session. - Find other installations: Run
/usr/libexec/java_home -Vto list Java installations recognized by macOS. - Check the right runtime: Your project or app can use a different Java installation from Terminal.
- Use existing tools: You do not need to download Java merely to check an existing installation.
| Method or place | What you can check | When to use it |
|---|---|---|
| Terminal version command | Selected Java runtime and build | Start here |
| Additional Java flags | Version, properties and JVM build details | You need more runtime information |
| macOS installation list | Recognized versions, architectures, vendors and paths | You need to find other installations |
| Specific release check | Version selected for a requested release | Several releases are installed |
| Full executable path | Version of that exact executable | You know the installation location |
| Compiler version command | Selected Java compiler version | You use a JDK |
| Finder installation folder | Standard installation bundle names | You want to inspect installed folders |
| Homebrew | Installed Java package versions | Homebrew already manages your Java |
| SDKMAN! | Managed installed and selected versions | SDKMAN! is already initialized |
| jEnv | Registered versions and current selection | jEnv is already configured |
| IntelliJ IDEA project settings | Configured project or module SDK | You need a project's Java version |
| IntelliJ IDEA runtime chooser | The IDE's own runtime | You need the Java powering the IDE |
| Running JVM diagnostics | An attachable Java process's version | Matching JDK tools are available |
| Oracle Java 8 JRE executable | The separately installed JRE version | You have that Oracle Java 8 installation |
| Oracle Java Downloads | Available macOS downloads | You separately need an installation |
Check your Java version in Terminal
Open Finder > Applications > Utilities > Terminal. Type the following command, then press Return.
java -versionRead the version and runtime or build information printed below the command. This identifies the Java selected by your current Terminal session. If that is the installation you wanted to check, you can stop here.
If the command fails to return a version, try the installation list below or check a known Java executable by its full path. Those checks let you inspect recognized installations or a runnable installation outside the shell's search path.
List the Java installations recognized by macOS
Enter the following command in Terminal and press Return. Read each entry's version, CPU architecture, vendor and installation path.
/usr/libexec/java_home -VUse the entries to identify the installation you want to inspect next. The list covers installations registered for discovery by java_home, including registered Azul Zulu JDKs and JREs. It is not a guaranteed inventory of private app runtimes or manually unpacked installations.
If the JAVA_VERSION environment variable is set, it can filter the results. Run the following command and press Return to remove that filter for this command only.
(unset JAVA_VERSION; /usr/libexec/java_home -V)Check a particular Java installation
Once you identify an installed major release, request its version directly. For an installed Java 21 release, enter the following command and press Return.
/usr/libexec/java_home -v 21 --exec java -versionReplace 21 with the installed release you want to check; for Java 8, use 1.8. Read the returned version to confirm which installation was selected. This method applies to installations recognized by java_home.
To check an exact executable, use its full path. Replace the example path below with the actual location, keep the quotation marks, and press Return.
"/full/path/to/Contents/Home/bin/java" -versionThis works for accessible, runnable installations outside the shell's search path, too. For an app-bundled runtime, you need the app's actual runtime location and an included Java executable.
For Oracle JDK 27 installed in its standard location, you can use the following path directly. Run the command and press Return to check that installation.
/Library/Java/JavaVirtualMachines/jdk-27.jdk/Contents/Home/bin/java -versionOracle's separately installed Java 8 JRE has a different executable location. If you have that JRE installed at the location below, run this command and press Return to check it, even when java -version selects another JDK.
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -versionInspect Java folders in Finder
In Finder, press Shift + Command + G to open Go to Folder. Enter the following path, then press Return.
/Library/Java/JavaVirtualMachines/Inspect the bundle names in this standard system directory. They help identify installed release families, but may omit patch versions and do not identify the active runtime. Use the installation's executable with -version to establish its exact build.
If you prefer Terminal, you can list the same directory's entries there. Run the following command and press Return.
ls -1 /Library/Java/JavaVirtualMachines/Check Java managed by an existing tool
If Homebrew already manages Java on your Mac, use its package records to inspect installed versions. Run the following command, press Return, and look for Java-related formula entries.
brew list --versionsFor a known formula, narrow the result to its name. Run the following command and press Return, replacing openjdk if your formula has a different name.
brew list --versions openjdkTo inspect package details for that formula, use the next command. Press Return, then distinguish the installed package information from the currently available upstream version.
brew info openjdkFor an installed Temurin cask, use the following command and press Return. Homebrew's package records do not establish which runtime your shell or an app currently uses.
brew info --cask temurinIf SDKMAN! is already installed and initialized in your Terminal session, check its selected Java version with the following command. Press Return to display the selection.
sdk current javaTo inspect SDKMAN!'s available, installed and currently selected versions together, run the next command and press Return. Use the displayed markers to distinguish those categories.
sdk list javaFor an existing jEnv setup, enter the following command and press Return. Read the registered versions and the entry marked with an asterisk.
jenv versionsA project-local jEnv selection can differ from the global selection. Run the following command in the same directory and press Return to confirm the runtime actually selected there.
java -versionCheck the Java version used by IntelliJ IDEA
In IntelliJ IDEA 2026.3, open File > Project Structure > Project Settings > Project and inspect SDK. To inspect configured installations, open File > Project Structure > Platform Settings > SDKs.
A module can have its own selection. Within Project Structure, open Project Settings > Modules, select the module, then open Dependencies and inspect Module SDK. These configured JDKs can differ from your Terminal selection.
JetBrains says the IDE normally uses its bundled JetBrains Runtime, which is separate from your project SDK. To inspect it, open Help > Find Action…, find and select Choose Boot Java Runtime for the IDE…, then read the runtime information in the dialog. Close the dialog without applying a change.
Get compiler and runtime details when needed
On Java 9 and later, you can use the following alternative version command. Run it and press Return to print version information to standard output.
java --versionIf you have a JDK with its compiler executable available, check the selected compiler with the next command. Press Return and read the compiler version, which can differ from the runtime selected by java.
javac -versionCurrent JDKs also accept the following compiler version flag. Run it and press Return if you prefer this form.
javac --versionFor more runtime details with Oracle JDK 27, the following command includes system properties such as the runtime version and installation location. Run it and press Return; availability of these diagnostic options can vary with other JVM implementations.
java -XshowSettings:properties -versionWith Oracle JDK 27, you can also request more detailed JVM build information. Enter the following command and press Return.
java -XinternalversionTo inspect a running Java application's JVM, you need suitable JDK diagnostic tools matching the target JDK version and an attachable process. Run the tools under the same effective user and group as that process. Start with the following command and press Return to list discoverable Java processes.
jcmd -lNote the target process ID from the list. Replace 12345 below with that ID, then press Return to request its JVM version.
jcmd 12345 VM.versionIf you also need that process's runtime properties, use the next command with the same process ID. Press Return to display the properties.
jcmd 12345 VM.system_propertiesReplace outdated checks with executable checks
If older instructions send you to Java Preferences, use the Terminal version check instead; Oracle identifies that application as retired. The Java Control Panel and Java Console belong to older Java deployment environments. Applet-based version detection is also obsolete in current Chrome and Firefox, so check the executable directly.
If you separately need an installation, open Oracle Java Downloads and inspect the desired release's macOS options. Choose from the options for supported macOS and processor combinations. No download is required merely to check an existing installation.
Frequently Asked Questions
Why might you have Java but no Java compiler?
A standalone JRE does not include the javac compiler. You need a JDK with its compiler executable available to check the compiler version.
Does every entry in jEnv mean a separate Java installation?
No, multiple jEnv aliases can represent one installation. You cannot determine the number of separate installations from the number of registered entries alone.
Can the old Java Control Panel show all your JDKs?
No, the Oracle Java 8 Control Panel runtime table on macOS displays the currently installed JRE and excludes JDKs. The Control Panel was removed from JDK 11 onward.
Does the Oracle Java Downloads page detect your installed version?
No, it identifies available downloads. It does not detect the Java version installed on your Mac.