Class SystemUtils

java.lang.Object
org.apache.maven.surefire.booter.SystemUtils

public final class SystemUtils extends Object
JDK 9 support.
Since:
2.20.1
Author:
Tibor Digana (tibor17)
  • Method Details

    • endsWithJavaPath

      public static boolean endsWithJavaPath(String jvmExecPath)
      Parameters:
      jvmExecPath - e.g. /jdk/bin/java, /jdk/jre/bin/java
      Returns:
      true if jvmExecPath is path to java binary executor
    • toJdkHomeFromJvmExec

      public static File toJdkHomeFromJvmExec(String jvmExecutable)
      If jvmExecutable is /jdk/bin/java (since jdk9) or /jdk/jre/bin/java (prior to jdk9) then the absolute path to JDK home is returned /jdk.
      Null is returned if jvmExecutable is incorrect.
      Parameters:
      jvmExecutable - /jdk/bin/java* or /jdk/jre/bin/java*
      Returns:
      path to jdk directory; or null if wrong path or directory layout of JDK installation.
    • toJdkHomeFromJre

      public static File toJdkHomeFromJre()
      If system property java.home is /jdk (since jdk9) or /jdk/jre (prior to jdk9) then the absolute path to JDK home is returned /jdk.
      Returns:
      path to JDK
    • toJdkVersionFromReleaseFile

      public static BigDecimal toJdkVersionFromReleaseFile(File jdkHome)
    • isJava9AtLeast

      public static boolean isJava9AtLeast(String jvmExecutablePath)
    • isBuiltInJava9AtLeast

      public static boolean isBuiltInJava9AtLeast()
    • isJava9AtLeast

      public static boolean isJava9AtLeast(BigDecimal version)
    • platformClassLoader

      public static ClassLoader platformClassLoader()
    • pid

      public static Long pid()