Javatpoint Logo
Javatpoint Logo

How to Verify Java Version

There are different versions of JRE. Some of the applications generally require different version because of compatibility problems. The first number in the version denotes the major version and the second number indicates the release. Java provides -version option to check the current java version.

A version string contains a version number optionally followed by pre-release and build information.

There are following ways to check the Java version:

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

Using Command Prompt

Step 1: Open the Command Prompt.

Step 2: Use the following command and press enter key.


How to Verify Java Version

If the response to the java -version command shows 'java' is not recognized, you must add Java to the system path environment variable.


Using Control Panel

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

How to Verify Java Version

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

How to Verify Java Version

Step 3: About Java window appears, which shows the Java version.

How to Verify Java Version

Using Java System Class

Java System class provides the getProperty() method to verify the version. The getProperty() method accepts a key as an argument. A key is the name of the system property. The signature of the method is:

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.

Example

Output:

How to Verify Java Version
Next TopicJava Tutorial




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA