Package spock.util.environment
Class Jvm
- java.lang.Object
-
- spock.util.environment.Jvm
-
public class Jvm extends java.lang.Object
Provides information on the current JVM, such as its Java version.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Jvm
getCurrent()
Returns the current JVM.java.lang.String
getJavaSpecificationVersion()
The Java specification version, as returned by thejava.specification.version
system property.java.lang.String
getJavaVersion()
The Java version, as returned by thejava.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
isJava5()
Tells whether the Java version is 5.boolean
isJava5Compatible()
Tells whether the Java version is compatible with Java 5.boolean
isJava6()
Tells whether the Java version is 6.boolean
isJava6Compatible()
Tells whether the Java version is compatible with Java 6.boolean
isJava7()
Tells whether the Java version is 7.boolean
isJava7Compatible()
Tells whether the Java version is compatible with Java 7.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.
-
-
-
Method Detail
-
getJavaVersion
public java.lang.String getJavaVersion()
The Java version, as returned by thejava.version
system 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.version
system property
-
getJavaSpecificationVersion
public java.lang.String getJavaSpecificationVersion()
The Java specification version, as returned by thejava.specification.version
system property. Examples for valid values are"1.6"
and"1.7"
.- Returns:
- the Java specification version, as returned by the
java.specification.version
system property
-
isJava5
public boolean isJava5()
Tells whether the Java version is 5.- Returns:
- whether the Java version is 5
-
isJava6
public boolean isJava6()
Tells whether the Java version is 6.- Returns:
- whether the Java version is 6
-
isJava7
public boolean isJava7()
Tells whether the Java version is 7.- Returns:
- whether the Java version is 7
-
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
-
isJava5Compatible
public boolean isJava5Compatible()
Tells whether the Java version is compatible with Java 5.- Returns:
- whether the Java version is compatible with Java 5
-
isJava6Compatible
public boolean isJava6Compatible()
Tells whether the Java version is compatible with Java 6.- Returns:
- whether the Java version is compatible with Java 6
-
isJava7Compatible
public boolean isJava7Compatible()
Tells whether the Java version is compatible with Java 7.- Returns:
- whether the Java version is compatible with Java 7
-
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
-
isJava11Compatible
public boolean isJava11Compatible()
Tells whether the Java version is compatible with Java 11.- Returns:
- whether the Java version is compatible with Java 11
-
getCurrent
public static Jvm getCurrent()
Returns the current JVM.- Returns:
- the current JVM
-
-