How to Determine Your Java Version Using the Command Prompt (CMD)
How to Check Java Version from CMD
Checking the Java version on your system is an essential step when troubleshooting or ensuring compatibility with Java-based applications. The Command Prompt (CMD) is a versatile tool that allows you to execute various commands on your Windows system. In this article, we will guide you through the process of checking the Java version using the CMD.
Step 1: Open Command Prompt
To begin, you need to open the Command Prompt on your Windows system. There are several ways to do this:
1. Press the Windows key + R to open the Run dialog box.
2. Type “cmd” in the Run dialog box and press Enter.
3. Alternatively, you can search for “Command Prompt” in the Start menu and click on the application to open it.
Step 2: Check Java Version Using the ‘java -version’ Command
Once the Command Prompt is open, you can check the Java version by typing the following command and pressing Enter:
“`
java -version
“`
This command will display the version of Java installed on your system, along with additional information such as the Java Runtime Environment (JRE) and Java Virtual Machine (JVM) specifications.
Step 3: Interpret the Output
The output of the ‘java -version’ command will provide you with the following information:
1. Java Version: This is the main version number of Java, such as 1.8.0_251.
2. Java Runtime Environment (JRE): This indicates the version of the JRE installed on your system.
3. Java Virtual Machine (JVM): This shows the version of the JVM being used by your Java application.
For example, an output might look like this:
“`
java version “1.8.0_251”
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
“`
In this case, the Java version is 1.8.0_251, the JRE version is also 1.8.0_251, and the JVM version is 25.25-b02.
Step 4: Use the ‘javac -version’ Command for Java Compiler
If you want to check the version of the Java compiler, you can use the ‘javac -version’ command instead. This command will display the version of the Java compiler installed on your system.
“`
javac -version
“`
The output will show the version of the Java compiler, which should match the Java version you checked earlier.
Conclusion
Checking the Java version from the Command Prompt is a straightforward process that can help you identify compatibility issues and troubleshoot problems with Java-based applications. By following the steps outlined in this article, you can easily determine the Java version on your Windows system and ensure that your Java applications are running on the correct version.