Javatpoint Logo
Javatpoint Logo

How to Check JRE Version?

There are different versions of Java is available. Some of the applications generally require different version because of compatibility problems. In this section, we will learn how to check JRE version in Windows using CMD.

A version string contains a version number optionally followed by pre-release and build information. The first number in Java version represents the major version and the second number represents the release. Java provides -version option to find the current JRE version.

There are following ways to find the Java version in Windows:

  • Using Command Prompt
  • Using Java System Class
  • Using Control Panel

Note: Before checking the Java version, ensure that Java is installed and the path is properly set.

Using Command Prompt

By using the Command Prompt, we can easily find the Java version. The Java provides -version option to check the Java version. It prints the product version. To find the Java version in CMD, follow the steps given below:

Step 1: Open the Command Prompt by pressing Windows Key + R, type cmd and press enter key or click on the OK button. It opens the Command Prompt window.

Step 2: Type the following command in the prompt window and press enter key. It shows the Java version.

How to Check JRE Version

If the above command shows 'java' is not recognized, it means the path is not properly set. To resolve this problem, we must add the Java path to the system environment variable.

Using Java System Class

Another way to find the Java version is to use the System class. It provides the getProperty() method that finds the Java version. The getProperty() method accepts a key as an argument. A key is the name of the system property.

Syntax:

The method returns the String value of the system property, or null if there is no property with that key. It throws NullPointerException if the key is null and IllegalArgumentException if the key is empty.

Let's find Java version through a program.

FindJavaVersion.java

Output:

How to Check JRE Version

We can also find the Java version by using the Control Panel.

Step 1: Open the Control Panel and click on the Java icon. It shows the Java Control Panel.

How to Check JRE Version

Step 2: In the Java Control Panel, click on the About button.

How to Check JRE Version

When we click on the About button, the About Java dialog box appears that shows the Java version.

How to Check JRE Version





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA