How to jdk version

Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.

Last updated: April 4, 2026

Quick Answer: To check your JDK version, open your command prompt or terminal and type `java -version`. This command will display the installed Java Runtime Environment (JRE) version, which is typically part of the JDK. If you need to see the full JDK version, you might need to use commands like `javac -version` (for the compiler) or check your system's environment variables.

Key Facts

What is a JDK Version?

The Java Development Kit (JDK) is a collection of software tools used for developing applications in the Java programming language. Each JDK version represents a specific release of these tools, including the Java Runtime Environment (JRE), the Java compiler (javac), and other utilities. These versions are important because they introduce new features, performance improvements, security updates, and bug fixes. Developers and users often need to know their installed JDK version to ensure compatibility with specific software, libraries, or development frameworks.

Why is Knowing Your JDK Version Important?

Understanding your JDK version is crucial for several reasons:

How to Check Your JDK Version

Checking your JDK version is a straightforward process that can be done through your system's command line interface (CLI). The specific commands may vary slightly depending on your operating system (Windows, macOS, Linux) and how you installed the JDK.

Using the Command Prompt or Terminal

The most common way to check the installed Java version is by opening your command prompt (Windows) or terminal (macOS/Linux) and executing the following command:

java -version

This command will display information about the Java Runtime Environment (JRE) that is currently active on your system. The JRE is the part of the JDK that runs Java applications. The output will typically look something like this:

openjdk version "11.0.12" 2021-07-20OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2) (build 11.0.12+7-post-Debian-2)OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)

In this example, the JRE version is 11.0.12. Since the JRE is bundled with the JDK, this gives you a good indication of the associated JDK version.

Checking the Java Compiler Version

If you are a developer and want to specifically check the version of the Java compiler (javac) that is installed as part of your JDK, you can use the following command:

javac -version

The output will look similar to this:

javac 11.0.12

This command confirms the version of the compiler, which is directly tied to the JDK version. If `javac` is not recognized as a command, it might mean that the JDK is not installed, or its `bin` directory is not correctly added to your system's PATH environment variable.

Checking Environment Variables

In some cases, especially if you have multiple JDKs installed, you might need to check your system's environment variables to determine which JDK is currently set as the default. The primary environment variable to look for is `JAVA_HOME`. This variable typically points to the root directory of your JDK installation.

On Windows:

  1. Search for "Environment Variables" in the Windows search bar and select "Edit the system environment variables".
  2. Click the "Environment Variables..." button.
  3. Under "System variables" or "User variables", look for `JAVA_HOME`. The value associated with it should be the path to your JDK installation (e.g., `C:\Program Files\Java\jdk-11.0.12`).

On macOS/Linux:

Open your terminal and type:

echo $JAVA_HOME

This will display the path if the `JAVA_HOME` variable is set.

Understanding JDK Version Numbers

Java versions follow a numbering scheme that indicates the release and its significance. Common version series include:

The version number often includes major release numbers (e.g., 8, 11, 17) and sometimes update numbers (e.g., 11.0.12).

Troubleshooting Common Issues

'java' is not recognized as an internal or external command: This error usually means that Java is not installed, or the JDK's `bin` directory is not added to your system's PATH environment variable. You need to install the JDK and configure your PATH.

Multiple JDKs Installed: If you have multiple JDKs installed, ensure that the `JAVA_HOME` environment variable and your system's PATH are configured to point to the desired JDK version. You might need to switch between versions depending on your project requirements.

Checking the Correct Installation: Always ensure you are checking the version in the correct command prompt or terminal window, especially if you have recently installed or modified environment variables.

Sources

  1. Java SE Development Kit (JDK) Tutorialfair-use
  2. Java Development Kit - WikipediaCC-BY-SA-4.0
  3. Java SE Development Kit (JDK) Archive Downloadsfair-use

Missing an answer?

Suggest a question and we'll generate an answer for it.