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 Details

    • 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: