Determining the installed JDK version on a Windows machine is a fundamental task for any Java developer or system administrator. Whether you are troubleshooting compatibility issues, setting up a new development environment, or verifying a deployment, knowing the exact build number is critical. This guide provides a detailed walkthrough of the various methods to check your JDK version, explaining the nuances of each approach.
Why Checking the JDK Version Matters
Before diving into the "how," it is important to understand the "why." The JDK (Java Development Kit) is not a single, static platform; it evolves rapidly with new features, performance enhancements, and security patches. Java 11, for example, marked a significant shift to a shorter release cadence, with new versions appearing every six months. If you are running an application built for JDK 8 on a machine with JDK 17, you might encounter deprecated APIs or behavioral changes. Conversely, trying to compile code that uses text blocks on an older JDK will result in compilation errors. Therefore, accurately checking your java and javac versions ensures that your development environment aligns with your project requirements.
Method 1: The Command Line (CMD and PowerShell)
The most direct way to check your JDK version is through the command line interface. This method is preferred by developers because it is quick and provides specific version metadata. You need to verify two distinct components: the Java Runtime Environment (JRE) version, which executes code, and the Java Compiler (javac) version, which builds code.

Using the java -version Command
To check the runtime environment, open Command Prompt (CMD) or PowerShell and type the following command:
java -version
Upon execution, the console will return the version string. For example, you might see output indicating "openjdk version "17.0.1" or "Java(TM) SE Runtime Environment (build 1.8.0_391-b09)." This output confirms the runtime environment is active and reports the major version number.
Using the javac -version Command
To ensure you can compile code, check the compiler version:

javac -version
This command returns the version of the compiler, such as "javac 11.0.2." It is crucial that the version of `javac` matches the version expected by your IDE or build tool. A mismatch here is a common source of "Unsupported Class File" errors.
Method 2: Locating the JDK Installation Directory
Sometimes, the command line might return results from a JRE installed on the system rather than the actual JDK development kit. If you need to confirm the physical location of the JDK files—perhaps to inspect the library files or configure an IDE manually—you can navigate the file system directly.
Standard File Paths
By default, the JDK is installed in the "Program Files" directory. Navigate to the following path in File Explorer:

C:\Program Files\Java\ |
Within this folder, you will see subdirectories named according to the JDK version, such as "jdk-17" or "jdk1.8.0_391." The presence of a "bin" folder inside these directories (e.g., C:\Program Files\Java\jdk-17\bin) is a clear indicator that a full JDK is installed, not just a JRE.
Method 3: Via the Environment Variables
Windows uses environment variables to tell the system where to find executable files. The JAVA_HOME variable specifically points to the root directory of your JDK installation. Checking this variable is a quick way to see which JDK your system is configured to use by default.
Checking JAVA_HOME
To verify this setting, go to the Windows Search bar, type "Environment Variables," and open the "Edit the system environment variables" panel. Click "Environment Variables." Under "System variables," look for JAVA_HOME. Selecting it will reveal the path it points to, which should lead directly to your JDK folder (e.g., JAVA_HOME=C:\Program Files\Java\jdk-11.0.2). If this variable is missing or points to a JRE folder, you may encounter issues with command-line compilation.
Troubleshooting Common Inconsistencies
Users often encounter discrepancies between different methods of checking the version. You might run java -version and see Java 17, while your IDE is using Java 11. This usually happens because the PATH variable points to a different Java executable than the JAVA_HOME variable.
Resolving PATH Conflicts
The Windows PATH variable is a queue of directories that the command prompt searches for executables. If an older version of Java appears first in the PATH, that version will be executed when you type "java" in any new terminal window. To fix this:
- Access the Environment Variables settings (as described above).
- Locate the
Pathvariable under "System variables" and click "Edit." - Ensure the path to your desired JDK's
binfolder appears at the top of the list.
Adjusting the PATH ensures that the command line, IDEs, and build tools (like Maven or Gradle) all reference the correct instance of the JDK.





















