How to Verify Java VersionThere 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 PromptStep 1: Open the Command Prompt. Step 2: Use the following command and press enter key. 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 PanelStep 1: Open Control Panel and click on Java icon. Step 2: In the Java Control Panel dialog box, click on About button. Step 3: About Java window appears, which shows the Java version. Using Java System ClassJava 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: Next TopicJava Tutorial |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India