How to Check Your Java Version (Windows, Mac, and Linux)
Java powers a surprising amount of software behind the scenes — from enterprise applications and Android development tools to Minecraft servers and legacy business software. Knowing which version of Java is installed on your system isn't just a developer concern. If you're troubleshooting an app that won't launch, setting up a development environment, or checking whether your system meets software requirements, knowing your Java version is often the first step.
Here's how to find it across every major operating system, plus what the version numbers actually mean.
Why Your Java Version Matters
Not all Java versions are interchangeable. Java is versioned, and software built for one version may behave unexpectedly — or refuse to run — on another. This is especially relevant because:
- Some applications require a minimum Java version to function
- Others are incompatible with newer releases due to deprecated APIs
- Enterprise environments often standardize on a Long-Term Support (LTS) release
- Security patches are only distributed for actively maintained versions
Java's versioning also has some historical quirks. Older versions used naming like Java 1.6 and Java 1.8 (also called Java 6 and Java 8). From Java 9 onward, Oracle simplified this to a straightforward integer: Java 11, Java 17, Java 21, and so on.
How to Check Java Version on Windows 💻
Method 1: Command Prompt
- Press
Windows + R, typecmd, and hit Enter - In the Command Prompt window, type:
java -version - Press Enter
You'll see output similar to:
java version "21.0.2" 2024-01-16 Java(TM) SE Runtime Environment (build 21.0.2+13-58) Java HotSpot(TM) 64-Bit Server VM (build 21.0.2+13-58, mixed mode, sharing) The first line tells you the version number. The second and third lines identify the build and the JVM (Java Virtual Machine) implementation.
Method 2: Windows Settings
Navigate to Settings → Apps → Installed Apps (or Programs and Features on older Windows versions) and search for "Java." This shows installed Java packages but may not reveal the full version string as clearly as the command line method.
How to Check Java Version on macOS 🍎
Using Terminal
- Open Terminal (find it in Applications → Utilities, or search with Spotlight)
- Type the same command:
java -version The output format is identical to Windows. macOS may also prompt you to install Java if none is detected, which is a useful indicator in itself.
If you have multiple Java versions installed — common among developers using tools like SDKMAN or Homebrew — you can list them all with:
/usr/libexec/java_home -V This returns every installed JDK with its version and architecture, which is helpful when managing multiple projects with different Java requirements.
How to Check Java Version on Linux
Open a terminal and run:
java -version Or alternatively:
java --version Note: --version (double dash) outputs a slightly different format and was introduced in Java 9. On systems running very old Java installations, only -version (single dash) may work.
On Linux, you may also have multiple Java versions managed through the system's package manager. On Debian/Ubuntu-based systems:
update-java-alternatives --list On RHEL/Fedora-based systems:
alternatives --config java These commands reveal which Java version is currently active and what other versions are available system-wide.
Understanding the Output
| Output Field | What It Means |
|---|---|
java version "21.0.2" | Full version number — major.minor.patch |
Java SE Runtime Environment | This is the JRE (runtime, for running apps) |
Java(TM) SE Development Kit | This is the JDK (includes compiler and dev tools) |
HotSpot | Oracle's JVM implementation |
OpenJ9 or GraalVM | Alternative JVM implementations |
64-Bit Server VM | Architecture and optimization mode |
JRE vs. JDK is a distinction worth understanding here. The JRE (Java Runtime Environment) is what most end users need — it runs Java applications. The JDK (Java Development Kit) includes everything in the JRE plus compilers and debugging tools, and is what developers install. If java -version works but javac -version doesn't, you have a JRE but not a JDK.
What If Java Isn't Installed?
If the command returns an error like 'java' is not recognized (Windows) or command not found (Mac/Linux), Java is either not installed or not added to your system's PATH environment variable.
PATH is the list of directories your operating system searches when you type a command. Java installers typically add themselves to PATH automatically, but this doesn't always happen — particularly with manual installations, portable versions, or certain package managers.
The Variables That Change the Answer
Checking your Java version sounds straightforward, but the results can vary significantly based on:
- How Java was installed — system package manager, Oracle installer, Homebrew, SDKMAN, or bundled with another application
- Whether multiple versions are installed — the version shown by
java -versionis whichever is currently set as the default - JRE vs. JDK — determining which you have affects what you can do with it
- Architecture — 32-bit vs. 64-bit Java behaves differently and has different compatibility implications
- Distribution — Oracle JDK, OpenJDK, Amazon Corretto, Eclipse Temurin, and GraalVM all report version numbers differently in their build strings
Someone running a single personal Java application and someone managing multiple Java-dependent projects on the same machine will have very different experiences interpreting the same command output — and may need to take very different next steps based on what they find.