Finding the Java Version Programatically

import java.util.*;public class FindJavaVersion{   public static void main(String args[])   {      FindJavaVersion findJavaVersion = new FindJavaVersion();      findJavaVersion.printDetails();   }      private void printDetails()   {      Properties systemProperties = System.getProperties();      System.out.println("Java version: " + systemProperties.get("java.version"));      System.out.println("File separator : " + systemProperties.get("file.separator"));      System.out.println("Java home: " + systemProperties.get("java.home"));         }}/*

Expected output:

[[email protected]]# java FindJavaVersionJava version: 1.8.0_102File separator : /Java home: /opt/Java/jre1.8.0_102*/
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Related Posts