devxlogo

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:

[root@mypc]# java FindJavaVersionJava version: 1.8.0_102File separator : /Java home: /opt/Java/jre1.8.0_102*/
Image

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.