On Linux OS both OpenJDK and Oracle JDK java variables Return the same results. How can I detect whether running Java is OpenJDK or Orackle JDK?
Code:
System.out.println("java.vendor: " + System.getProperty("java.vendor"));
System.out.println("java.version: " + System.getProperty("java.version"));
System.out.println("java.vendor.url: " + System.getProperty("java.vendor.url"));
Output:
java.vendor: Oracle Corporation
java.version: 1.7.0_55
java.vendor.url: http://java.oracle.com/
java -version command for two JDK is:
java version "1.7.0_55"
OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Server VM (build 24.51-b03, mixed mode)
Try:
System.out.println(System.getProperty("java.vm.name"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With