Class 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 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 a VersionNumber instance.
      • getCurrentRuntimeJavaVersion

        public static String getCurrentRuntimeJavaVersion()
        Returns the JVM's current version as a String. 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)