How to display Java Runtime Environment (JRE) version


Use the System.getProperty() method in Java to get the Java Runtime Environment.

It’s syntax is −

String getProperty(String key)

Above, the key is the name of the system property. Since, we want the Java Runtime Environment name, therefore we will add the key as −

java.version

The following is an example −

Example

 Live Demo

public class Demo {
   public static void main(String[] args) {
      System.out.print("Java Specification Version: ");
      System.out.println(System.getProperty("java.specification.version"));
      System.out.print("java Runtime Environment (JRE) version: ");
      System.out.println(System.getProperty("java.version"));
   }
}

Output

Java Specification Version: 1.8
java Runtime Environment (JRE) version: 1.8.0_141

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 30-Jul-2019

339 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements