
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Find Java Version Using Command Line
You can find the version of the Java software currently installed in your system using Programs and using Command prompt.
Using Command prompt
The -version command of the java command prompt gives you the current version of the Java software installed in your system.
Therefore, open command prompt and type the command java -version to get the version of Java installed in your system.

Using the Java program
The System class of java.lang package provides a method named getProperty() this method accepts one of the following string parameters an returns the respective property.
To get the version of the java installed in the system, invoke the getProperty() method by passing the value "os.name" to it, as shown in the following sample code.
Example
public class Test { public static void main(String args[]) { Test obj = new Test(); String os = System.getProperty("java.version"); System.out.println("Current Java version is: "+os); } }
Output
Current Java version is: 1.8.0_101
Advertisements