f you want to know whether the currently running JVM is HotSpot or JRockit, check
System.getProperty("java.vm.name")
. For me, it gives Java HotSpot(TM) 64-Bit Server VM
on HotSpot and Oracle JRockit(R)
on JRockit, although different versions/platforms may give slightly different results, so the most reliable method may be:String jvmName = System.getProperty("java.vm.name");
boolean isHotSpot = jvmName.toUpperCase().indexOf("HOTSPOT") != -1;
boolean isJRockit = jvmName.toUpperCase().indexOf("JROCKIT") != -1;
Thorbjørn's suggestion to use
java.vendor
has the problem that the same vendor may produce multiple JVMs; indeed, since Oracle's acquisitions of BEA and Sun, both HotSpot and JRockit now report the same value: Oracle Corporation
If you want to find all JVMs installed on a system: the problem with Nambari's answer, to use the command
java -version
, is that the JVM can be installed on a machine yet not be present in the path. For Windows, scanning the registry could be a better approach.