static public void main(String[] arg) throws IOException { PrintStream out = System.out; Properties pro = System.getProperties(); Set set = pro.entrySet(); Iterator<Map.Entry<String , String >> itr = set.iterator(); while(itr.hasNext()) { Map.Entry ent = itr.next(); out.println(ent.getKey() + " -> " + ent.getValue() + "\n"); } }
Use System.getProperty("java.version") or System.getProperty("java.runtime.version") to get the installed version of java.
The above code allows you to find out more details such as the name of the Java provider, OS, etc.
Ravi jain
source share