Package org.apache.maven.surefire.booter
Class SystemUtils
- java.lang.Object
-
- org.apache.maven.surefire.booter.SystemUtils
-
public final class SystemUtils extends java.lang.Object
JDK 9 support.- Since:
- 2.20.1
- Author:
- Tibor Digana (tibor17)
-
-
Field Summary
Fields Modifier and Type Field Description static java.math.BigDecimal
JAVA_SPECIFICATION_VERSION
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
endsWithJavaPath(java.lang.String jvmExecPath)
static boolean
isBuiltInJava7AtLeast()
static boolean
isBuiltInJava9AtLeast()
static boolean
isJava9AtLeast(java.lang.String jvmExecutablePath)
static boolean
isJava9AtLeast(java.math.BigDecimal version)
static java.lang.Long
pid()
static java.lang.ClassLoader
platformClassLoader()
static java.io.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.static java.io.File
toJdkHomeFromJvmExec(java.lang.String jvmExecutable)
IfjvmExecutable
is /jdk/bin/java (since jdk9) or /jdk/jre/bin/java (prior to jdk9) then the absolute path to JDK home is returned /jdk.static java.math.BigDecimal
toJdkVersionFromReleaseFile(java.io.File jdkHome)
-
-
-
Method Detail
-
endsWithJavaPath
public static boolean endsWithJavaPath(java.lang.String jvmExecPath)
- Parameters:
jvmExecPath
- e.g. /jdk/bin/java, /jdk/jre/bin/java- Returns:
true
ifjvmExecPath
is path to java binary executor
-
toJdkHomeFromJvmExec
public static java.io.File toJdkHomeFromJvmExec(java.lang.String jvmExecutable)
IfjvmExecutable
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 ifjvmExecutable
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 java.io.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 java.math.BigDecimal toJdkVersionFromReleaseFile(java.io.File jdkHome)
-
isJava9AtLeast
public static boolean isJava9AtLeast(java.lang.String jvmExecutablePath)
-
isBuiltInJava9AtLeast
public static boolean isBuiltInJava9AtLeast()
-
isBuiltInJava7AtLeast
public static boolean isBuiltInJava7AtLeast()
-
isJava9AtLeast
public static boolean isJava9AtLeast(java.math.BigDecimal version)
-
platformClassLoader
public static java.lang.ClassLoader platformClassLoader()
-
pid
public static java.lang.Long pid()
-
-