How to Check What Version of Java You Have

Java powers everything from enterprise applications to development tools, game servers, and browser plugins. But not all Java versions behave the same way — and knowing exactly which version is installed on your system matters more than most people realize. Here's how to find out, across every major platform.

Why Your Java Version Actually Matters

Java releases follow a versioning system where major version numbers (Java 8, 11, 17, 21) signal significant changes in features, performance, and long-term support status. Some applications are built for a specific version and will refuse to run — or behave unpredictably — on anything older or newer.

There's also the distinction between JRE (Java Runtime Environment) and JDK (Java Development Kit). The JRE is what end users need to run Java applications. The JDK is what developers need to write and compile code. Both carry version numbers, and you may have one, the other, or both installed — sometimes in multiple versions simultaneously.

How to Check Your Java Version on Windows 🖥️

Option 1: Command Prompt

  1. Press Win + R, type cmd, and hit Enter
  2. In the terminal, type: java -version
  3. Press Enter

You'll see output similar to:

java version "17.0.9" 2023-10-17 Java(TM) SE Runtime Environment (build 17.0.9+11-LTS-201) Java HotSpot(TM) 64-Bit Server VM (build 17.0.9+11-LTS-201, mixed mode, sharing) 

The first line tells you everything: the major version (17), the minor version (0), and the patch number (9).

Option 2: Control Panel

On older Windows setups with the Java Control Panel still visible:

  1. Open Control Panel → Programs → Java
  2. Click the Java tab, then View

This shows installed runtime versions but may not appear on systems running newer Java builds, which no longer install the Control Panel applet by default.

Option 3: System Settings Search

Search "Java" in the Windows search bar. If the Java Control Panel is installed, it will appear. If nothing shows up, use the Command Prompt method instead — it's the most reliable across all Windows versions.

How to Check Your Java Version on macOS

Using Terminal:

  1. Open Terminal (Applications → Utilities → Terminal)
  2. Type: java -version
  3. Press Enter

The output format is identical to Windows. If Java isn't installed, macOS will prompt you to install it.

To see all installed versions (useful if you've used tools like Homebrew or SDKMAN):

/usr/libexec/java_home -V 

This lists every JDK installed on your Mac along with their paths — helpful when multiple versions coexist.

How to Check Your Java Version on Linux 🐧

Open a terminal and run:

java -version 

Or for more detail about the compiler version if you have the JDK:

javac -version 

On Linux, multiple Java versions are common, especially on developer machines. To see all installed versions and which one is currently active:

update-alternatives --list java 

This shows the full paths of every installed Java binary, letting you identify the version number from the path itself (e.g., /usr/lib/jvm/java-17-openjdk-amd64).

Understanding the Version Number Output

Java versioning changed after Java 8. Here's how to read what you see:

Output ExampleWhat It Means
java version "1.8.0_391"Java 8 (legacy format)
java version "11.0.21"Java 11
java version "17.0.9"Java 17
java version "21.0.1"Java 21

Before Java 9, the format was 1.x — so 1.8 means Java 8. From Java 9 onward, the version number is stated directly. This trips up a lot of users who see 1.8 and assume it's an old or low version number.

When You Have Multiple Java Versions Installed

This is more common than most people expect. Developers often maintain multiple versions for different projects. Tools like SDKMAN, jEnv, or Homebrew on Mac and Linux make managing multiple versions practical — but they also mean the version returned by java -version may not be the only one on your system.

Which version runs by default is determined by your system's PATH environment variable. The Java binary that appears first in the PATH is what executes when you type java -version. This is worth knowing because an application might be using a different Java version than what your terminal reports, depending on how it was launched or configured.

On Windows, applications can also reference a specific Java installation via the JAVA_HOME environment variable, bypassing the default PATH entry entirely.

What the Version Tells You — and What It Doesn't

Knowing your version number is the starting point, not the finish line. The version alone tells you:

  • Whether an application's minimum Java requirement is met
  • Whether you're running an LTS (Long-Term Support) release — Java 8, 11, 17, and 21 are current LTS versions — or a short-term release
  • Whether your installation is current within its version line (patch updates fix security vulnerabilities)

What it doesn't tell you is whether that version is the right one for your specific use case — and that depends on factors like the software you're running, whether you're developing or just executing, your operating system's compatibility quirks, and whether the application vendor has version-specific requirements or restrictions.

That last piece — matching your installed version to what your actual workflow demands — is where the straightforward "check your version" step ends and the more specific decision-making begins.