- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to find the version of Java 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
- Related Articles
- How do I know which MongoDB version is installed using the Command Line?
- Java command line arguments
- How to find the device driver version using PowerShell?
- How to find the R version you are using?
- Command line arguments in Java
- Explain Java command line arguments.
- How to read a file from command line using Python?
- How to find the MySQL data directory from command line in Windows?
- Enable Assertions from the command line in Java
- Logging in SAP using command line
- How to write into a file from command line using Python?
- How to adjust display settings of MySQL command line?
- How to execute Python multi-line statements in the one-line at command-line?
- Command Line arguments in Java programming\n
- How to send a file as an email attachment using the Linux command line?

Advertisements