Basically, I'm trying to determine whether a user is using an IBM JDK or Oracle JDK from within the code itself, but can't think of an elegant solution outside of running command line arguments and using a string tokenizer. Does anybody know of an API or native method of discovering these details?
Developer Marius Žilėnas
6,1472 gold badges46 silver badges76 bronze badges
-
possible duplicate of Identify the current JVM with Java or JVMTIOscar Pérez– Oscar Pérez2014年01月27日 10:05:21 +00:00Commented Jan 27, 2014 at 10:05
2 Answers 2
For vendor and version
System.out.println(System.getProperty("java.vendor"));
System.out.println(System.getProperty("java.version"));
answered Jan 27, 2014 at 10:05
sanbhat
17.6k6 gold badges52 silver badges65 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
You can just use
String vendor=System.getProperty("java.vendor");
String version = System.getProperty("java.version");
System.out.println(vendor);
System.out.println(version);
This will give your jdk version with the vendor.
Out put:
Oracle Corporation
1.7.0_25
answered Jan 27, 2014 at 10:04
Ruchira Gayan Ranaweera
35.7k17 gold badges79 silver badges117 bronze badges
Comments
lang-java