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?
Asked
Active
Viewed 168 times
4
-
possible duplicate of [Identify the current JVM with Java or JVMTI](http://stackoverflow.com/questions/5583975/identify-the-current-jvm-with-java-or-jvmti) – Oscar Pérez Jan 27 '14 at 10:05
2 Answers
6
For vendor and version
System.out.println(System.getProperty("java.vendor"));
System.out.println(System.getProperty("java.version"));

sanbhat
- 17,522
- 6
- 48
- 64
5
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

Ruchira Gayan Ranaweera
- 34,993
- 17
- 75
- 115