What system properties are set by OpenJDK's vm that differentiate it from Sun/Oracle's vm?
java
Solution
Try using these:
System.out.println(System.getProperty("java.vm.version"));
System.out.println(System.getProperty("java.runtime.name"));
System.out.println(System.getProperty("java.vm.name"));
You might also like `System#getProperties()`:
System.getProperties().list(System.out);
which will list all the current System properties, to `System.out`.
Problem
Question: What system properties are set by OpenJDK's vm so that I can identify that I am running under OpenJDK and not under Sun/Oracle's vm? As shown here: https://gist.github.com/sinewalker/3890869, the following system properties are NOT sufficient for differentiating between OpenJDK's VM and Sun/Oracle's VM: System properties: ``` System.out.println(System.getProperty("java.vendor")); System.out.println(System.getProperty("java.vendor.url")); System.out.println(System.getProperty("java.version")); ``` Outputs the following using OpenJDK's vm (these are the same values you would see on Sun's VM): ``` Sun Microsystems Inc. http://java.sun.com/ 1.6.0_24 ``` I was expecting the property values to reflect what is output by the java command: ``` $ java -version java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode) ```