Package jenkins.util.java
Class JavaUtils
- java.lang.Object
-
- jenkins.util.java.JavaUtils
-
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class JavaUtils extends Object
Utility class for Java environment management and checks.- Author:
- Oleg Nenashev
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static io.jenkins.lib.versionnumber.JavaSpecificationVersion
getCurrentJavaRuntimeVersionNumber()
Returns the JVM's current version as aVersionNumber
instance.static String
getCurrentRuntimeJavaVersion()
Returns the JVM's current version as aString
.static boolean
isRunningWithJava8OrBelow()
Check whether the current JVM is running with Java 8 or belowstatic boolean
isRunningWithPostJava8()
Check whether the current JVM is running with Java 9 or above.
-
-
-
Method Detail
-
isRunningWithJava8OrBelow
public static boolean isRunningWithJava8OrBelow()
Check whether the current JVM is running with Java 8 or below- Returns:
true
if it is Java 8 or older version
-
isRunningWithPostJava8
public static boolean isRunningWithPostJava8()
Check whether the current JVM is running with Java 9 or above.- Returns:
true
if it is Java 9 or above
-
getCurrentJavaRuntimeVersionNumber
public static io.jenkins.lib.versionnumber.JavaSpecificationVersion getCurrentJavaRuntimeVersionNumber()
Returns the JVM's current version as aVersionNumber
instance.
-
getCurrentRuntimeJavaVersion
public static String getCurrentRuntimeJavaVersion()
Returns the JVM's current version as aString
. See JEP 223 for the expected format.- Until Java 8 included, the expected format should be starting with
1.x
- Starting with Java 9, cf. JEP-223 linked above, the version got simplified in 9.x, 10.x, etc.
- See Also:
System.getProperty(String)
- Until Java 8 included, the expected format should be starting with
-
-