Package spock.util.environment
Class Jvm
java.lang.Object
spock.util.environment.Jvm
Provides information on the current JVM, such as its Java version.
-
Method Summary
Modifier and TypeMethodDescriptionstatic JvmReturns the current JVM.The Java specification version, as returned by thejava.specification.versionsystem property.The Java version, as returned by thejava.versionsystem property.booleanisJava10()Tells whether the Java version is 10.booleanTells whether the Java version is compatible with Java 10.booleanisJava11()Tells whether the Java version is 11.booleanTells whether the Java version is compatible with Java 11.booleanisJava12()Tells whether the Java version is 12.booleanTells whether the Java version is compatible with Java 12.booleanisJava13()Tells whether the Java version is 13.booleanTells whether the Java version is compatible with Java 13.booleanisJava14()Tells whether the Java version is 14.booleanTells whether the Java version is compatible with Java 14.booleanisJava15()Tells whether the Java version is 15.booleanTells whether the Java version is compatible with Java 15.booleanisJava16()Tells whether the Java version is 16.booleanTells whether the Java version is compatible with Java 16.booleanisJava17()Tells whether the Java version is 17.booleanTells whether the Java version is compatible with Java 17.booleanisJava18()Tells whether the Java version is 18.booleanTells whether the Java version is compatible with Java 18.booleanisJava19()Tells whether the Java version is 19.booleanTells whether the Java version is compatible with Java 19.booleanisJava20()Tells whether the Java version is 20.booleanTells whether the Java version is compatible with Java 20.booleanisJava21()Tells whether the Java version is 21.booleanTells whether the Java version is compatible with Java 21.booleanisJava22()Tells whether the Java version is 22.booleanTells whether the Java version is compatible with Java 22.booleanisJava23()Tells whether the Java version is 23.booleanTells whether the Java version is compatible with Java 23.booleanisJava24()Tells whether the Java version is 24.booleanTells whether the Java version is compatible with Java 24.booleanisJava25()Tells whether the Java version is 25.booleanTells whether the Java version is compatible with Java 25.booleanisJava26()Tells whether the Java version is 26.booleanTells whether the Java version is compatible with Java 26.booleanisJava27()Tells whether the Java version is 27.booleanTells whether the Java version is compatible with Java 27.booleanisJava28()Tells whether the Java version is 28.booleanTells whether the Java version is compatible with Java 28.booleanisJava29()Tells whether the Java version is 29.booleanTells whether the Java version is compatible with Java 29.booleanisJava8()Tells whether the Java version is 8.booleanTells whether the Java version is compatible with Java 8.booleanisJava9()Tells whether the Java version is 9.booleanTells whether the Java version is compatible with Java 9.booleanisJavaVersion(int majorJavaVersion) Tells whether the Java version is equal to the given major Java version.booleanisJavaVersionCompatible(int majorJavaVersion) Tells whether the Java version is compatible with the given major Java version.
-
Method Details
-
getJavaVersion
The Java version, as returned by thejava.versionsystem property. Examples for valid values (for Oracle/OpenJDK) are"1.6.0_22"and"1.7.0_07".- Returns:
- the Java version, as returned by the
java.versionsystem property
-
getJavaSpecificationVersion
The Java specification version, as returned by thejava.specification.versionsystem property. Examples for valid values are"1.6"and"1.7".- Returns:
- the Java specification version, as returned by the
java.specification.versionsystem property
-
isJava8
public boolean isJava8()Tells whether the Java version is 8.- Returns:
- whether the Java version is 8
-
isJava9
public boolean isJava9()Tells whether the Java version is 9.- Returns:
- whether the Java version is 9
-
isJava10
public boolean isJava10()Tells whether the Java version is 10.- Returns:
- whether the Java version is 10
- Since:
- 1.2
-
isJava11
public boolean isJava11()Tells whether the Java version is 11.- Returns:
- whether the Java version is 11
- Since:
- 1.2
-
isJava12
public boolean isJava12()Tells whether the Java version is 12.- Returns:
- whether the Java version is 12
- Since:
- 2.0
-
isJava13
public boolean isJava13()Tells whether the Java version is 13.- Returns:
- whether the Java version is 13
- Since:
- 2.0
-
isJava14
public boolean isJava14()Tells whether the Java version is 14.- Returns:
- whether the Java version is 14
- Since:
- 2.0
-
isJava15
public boolean isJava15()Tells whether the Java version is 15.- Returns:
- whether the Java version is 15
- Since:
- 2.0
-
isJava16
public boolean isJava16()Tells whether the Java version is 16.- Returns:
- whether the Java version is 16
- Since:
- 2.0
-
isJava17
public boolean isJava17()Tells whether the Java version is 17.- Returns:
- whether the Java version is 17
- Since:
- 2.0
-
isJava18
public boolean isJava18()Tells whether the Java version is 18.- Returns:
- whether the Java version is 18
- Since:
- 2.0
-
isJava19
public boolean isJava19()Tells whether the Java version is 19.- Returns:
- whether the Java version is 19
- Since:
- 2.0
-
isJava20
public boolean isJava20()Tells whether the Java version is 20.- Returns:
- whether the Java version is 20
- Since:
- 2.0
-
isJava21
public boolean isJava21()Tells whether the Java version is 21.- Returns:
- whether the Java version is 21
- Since:
- 2.0
-
isJava22
public boolean isJava22()Tells whether the Java version is 22.- Returns:
- whether the Java version is 22
- Since:
- 2.0
-
isJava23
public boolean isJava23()Tells whether the Java version is 23.- Returns:
- whether the Java version is 23
- Since:
- 2.0
-
isJava24
public boolean isJava24()Tells whether the Java version is 24.- Returns:
- whether the Java version is 24
- Since:
- 2.4
-
isJava25
public boolean isJava25()Tells whether the Java version is 25.- Returns:
- whether the Java version is 25
- Since:
- 2.4
-
isJava26
public boolean isJava26()Tells whether the Java version is 26.- Returns:
- whether the Java version is 26
- Since:
- 2.4
-
isJava27
public boolean isJava27()Tells whether the Java version is 27.- Returns:
- whether the Java version is 27
- Since:
- 2.4
-
isJava28
public boolean isJava28()Tells whether the Java version is 28.- Returns:
- whether the Java version is 28
- Since:
- 2.4
-
isJava29
public boolean isJava29()Tells whether the Java version is 29.- Returns:
- whether the Java version is 29
- Since:
- 2.4
-
isJavaVersion
public boolean isJavaVersion(int majorJavaVersion) Tells whether the Java version is equal to the given major Java version.- Parameters:
majorJavaVersion- major java version (e.g. 8, 12, 17) to check the Java version is equal to- Returns:
- whether the Java version is equal to the given major Java version
- Since:
- 2.0
-
isJava8Compatible
public boolean isJava8Compatible()Tells whether the Java version is compatible with Java 8.- Returns:
- whether the Java version is compatible with Java 8
-
isJava9Compatible
public boolean isJava9Compatible()Tells whether the Java version is compatible with Java 9.- Returns:
- whether the Java version is compatible with Java 9
-
isJava10Compatible
public boolean isJava10Compatible()Tells whether the Java version is compatible with Java 10.- Returns:
- whether the Java version is compatible with Java 10
- Since:
- 1.2
-
isJava11Compatible
public boolean isJava11Compatible()Tells whether the Java version is compatible with Java 11.- Returns:
- whether the Java version is compatible with Java 11
- Since:
- 1.2
-
isJava12Compatible
public boolean isJava12Compatible()Tells whether the Java version is compatible with Java 12.- Returns:
- whether the Java version is compatible with Java 12
- Since:
- 2.0
-
isJava13Compatible
public boolean isJava13Compatible()Tells whether the Java version is compatible with Java 13.- Returns:
- whether the Java version is compatible with Java 13
- Since:
- 2.0
-
isJava14Compatible
public boolean isJava14Compatible()Tells whether the Java version is compatible with Java 14.- Returns:
- whether the Java version is compatible with Java 14
- Since:
- 2.0
-
isJava15Compatible
public boolean isJava15Compatible()Tells whether the Java version is compatible with Java 15.- Returns:
- whether the Java version is compatible with Java 15
- Since:
- 2.0
-
isJava16Compatible
public boolean isJava16Compatible()Tells whether the Java version is compatible with Java 16.- Returns:
- whether the Java version is compatible with Java 16
- Since:
- 2.0
-
isJava17Compatible
public boolean isJava17Compatible()Tells whether the Java version is compatible with Java 17.- Returns:
- whether the Java version is compatible with Java 17
- Since:
- 2.0
-
isJava18Compatible
public boolean isJava18Compatible()Tells whether the Java version is compatible with Java 18.- Returns:
- whether the Java version is compatible with Java 18
- Since:
- 2.0
-
isJava19Compatible
public boolean isJava19Compatible()Tells whether the Java version is compatible with Java 19.- Returns:
- whether the Java version is compatible with Java 19
- Since:
- 2.0
-
isJava20Compatible
public boolean isJava20Compatible()Tells whether the Java version is compatible with Java 20.- Returns:
- whether the Java version is compatible with Java 20
- Since:
- 2.0
-
isJava21Compatible
public boolean isJava21Compatible()Tells whether the Java version is compatible with Java 21.- Returns:
- whether the Java version is compatible with Java 21
- Since:
- 2.0
-
isJava22Compatible
public boolean isJava22Compatible()Tells whether the Java version is compatible with Java 22.- Returns:
- whether the Java version is compatible with Java 22
- Since:
- 2.0
-
isJava23Compatible
public boolean isJava23Compatible()Tells whether the Java version is compatible with Java 23.- Returns:
- whether the Java version is compatible with Java 23
- Since:
- 2.0
-
isJava24Compatible
public boolean isJava24Compatible()Tells whether the Java version is compatible with Java 24.- Returns:
- whether the Java version is compatible with Java 24
- Since:
- 2.4
-
isJava25Compatible
public boolean isJava25Compatible()Tells whether the Java version is compatible with Java 25.- Returns:
- whether the Java version is compatible with Java 25
- Since:
- 2.4
-
isJava26Compatible
public boolean isJava26Compatible()Tells whether the Java version is compatible with Java 26.- Returns:
- whether the Java version is compatible with Java 26
- Since:
- 2.4
-
isJava27Compatible
public boolean isJava27Compatible()Tells whether the Java version is compatible with Java 27.- Returns:
- whether the Java version is compatible with Java 27
- Since:
- 2.4
-
isJava28Compatible
public boolean isJava28Compatible()Tells whether the Java version is compatible with Java 28.- Returns:
- whether the Java version is compatible with Java 28
- Since:
- 2.4
-
isJava29Compatible
public boolean isJava29Compatible()Tells whether the Java version is compatible with Java 29.- Returns:
- whether the Java version is compatible with Java 29
- Since:
- 2.4
-
isJavaVersionCompatible
public boolean isJavaVersionCompatible(int majorJavaVersion) Tells whether the Java version is compatible with the given major Java version.- Parameters:
majorJavaVersion- major java version (e.g. 8, 12, 17) to check the Java version compatibility with- Returns:
- whether the Java version is compatible with the given major Java version
- Since:
- 2.0
-
getCurrent
Returns the current JVM.- Returns:
- the current JVM
-