public class Jvm extends Object
Modifier and Type | Method and Description |
---|---|
static Jvm |
getCurrent()
Returns the current JVM.
|
String |
getJavaSpecificationVersion()
The Java specification version, as returned by the
java.specification.version system property. |
String |
getJavaVersion()
The Java version, as returned by the
java.version system property. |
boolean |
isJava10()
Tells whether the Java version is 10.
|
boolean |
isJava10Compatible()
Tells whether the Java version is compatible with Java 10.
|
boolean |
isJava11()
Tells whether the Java version is 11.
|
boolean |
isJava11Compatible()
Tells whether the Java version is compatible with Java 11.
|
boolean |
isJava12()
Tells whether the Java version is 12.
|
boolean |
isJava12Compatible()
Tells whether the Java version is compatible with Java 12.
|
boolean |
isJava13()
Tells whether the Java version is 13.
|
boolean |
isJava13Compatible()
Tells whether the Java version is compatible with Java 13.
|
boolean |
isJava14()
Tells whether the Java version is 14.
|
boolean |
isJava14Compatible()
Tells whether the Java version is compatible with Java 14.
|
boolean |
isJava15()
Tells whether the Java version is 15.
|
boolean |
isJava15Compatible()
Tells whether the Java version is compatible with Java 15.
|
boolean |
isJava16()
Tells whether the Java version is 16.
|
boolean |
isJava16Compatible()
Tells whether the Java version is compatible with Java 16.
|
boolean |
isJava17()
Tells whether the Java version is 17.
|
boolean |
isJava17Compatible()
Tells whether the Java version is compatible with Java 17.
|
boolean |
isJava18()
Tells whether the Java version is 18.
|
boolean |
isJava18Compatible()
Tells whether the Java version is compatible with Java 18.
|
boolean |
isJava19()
Tells whether the Java version is 19.
|
boolean |
isJava19Compatible()
Tells whether the Java version is compatible with Java 19.
|
boolean |
isJava20()
Tells whether the Java version is 20.
|
boolean |
isJava20Compatible()
Tells whether the Java version is compatible with Java 20.
|
boolean |
isJava21()
Tells whether the Java version is 21.
|
boolean |
isJava21Compatible()
Tells whether the Java version is compatible with Java 21.
|
boolean |
isJava22()
Tells whether the Java version is 22.
|
boolean |
isJava22Compatible()
Tells whether the Java version is compatible with Java 22.
|
boolean |
isJava23()
Tells whether the Java version is 23.
|
boolean |
isJava23Compatible()
Tells whether the Java version is compatible with Java 23.
|
boolean |
isJava8()
Tells whether the Java version is 8.
|
boolean |
isJava8Compatible()
Tells whether the Java version is compatible with Java 8.
|
boolean |
isJava9()
Tells whether the Java version is 9.
|
boolean |
isJava9Compatible()
Tells whether the Java version is compatible with Java 9.
|
boolean |
isJavaVersion(int majorJavaVersion)
Tells whether the Java version is equal to the given major Java version.
|
boolean |
isJavaVersionCompatible(int majorJavaVersion)
Tells whether the Java version is compatible with the given major Java version.
|
public String getJavaVersion()
java.version
system property.
Examples for valid values (for Oracle/OpenJDK) are "1.6.0_22"
and "1.7.0_07"
.java.version
system propertypublic String getJavaSpecificationVersion()
java.specification.version
system property.
Examples for valid values are "1.6"
and "1.7"
.java.specification.version
system propertypublic boolean isJava8()
public boolean isJava9()
public boolean isJava10()
public boolean isJava11()
public boolean isJava12()
public boolean isJava13()
public boolean isJava14()
public boolean isJava15()
public boolean isJava16()
public boolean isJava17()
public boolean isJava18()
public boolean isJava19()
public boolean isJava20()
public boolean isJava21()
public boolean isJava22()
public boolean isJava23()
public boolean isJavaVersion(int majorJavaVersion)
majorJavaVersion
- major java version (e.g. 8, 12, 17) to check the Java version is equal topublic boolean isJava8Compatible()
public boolean isJava9Compatible()
public boolean isJava10Compatible()
public boolean isJava11Compatible()
public boolean isJava12Compatible()
public boolean isJava13Compatible()
public boolean isJava14Compatible()
public boolean isJava15Compatible()
public boolean isJava16Compatible()
public boolean isJava17Compatible()
public boolean isJava18Compatible()
public boolean isJava19Compatible()
public boolean isJava20Compatible()
public boolean isJava21Compatible()
public boolean isJava22Compatible()
public boolean isJava23Compatible()
public boolean isJavaVersionCompatible(int majorJavaVersion)
majorJavaVersion
- major java version (e.g. 8, 12, 17) to check the Java version compatibility withpublic static Jvm getCurrent()