|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.schmant.support.JdkUtil
public final class JdkUtil
This is a support class for working with JDK installations.
| Method Summary | |
|---|---|
static JdkVersion |
getCurrentJdkVersion()
Get the version of the currently running JVM. |
static File |
getJdkExecutable(File javaHome,
String cmd,
String... extensions)
Get a JDK command such as java or javac from a Java
installation. |
static File |
getJdkExecutable(String cmd,
String... extensions)
Get a JDK command such as java or javac from the default
Java installation. |
static File |
getJdkExecutableOrNull(File javaHome,
String cmd,
String... extensions)
Get a JDK command such as java or javac from the bin catalog of a Java installation. |
static File |
getJdkFile(File javaHome,
String relPath)
Get a Java installation file, such as jre/lib/rt.jar. |
static File |
getJdkFile(String relPath)
Get a Java installation file. |
static File |
getJdkFileOrNull(File javaHome,
String relPath)
Get a file, if it can be found, from a Java installation. |
static File |
getJdkFileOrNull(String relPath)
Get a file from the default Java installation. |
static JdkVersion |
getJdkVersion()
Get the version of the default Java installation. |
static JdkVersion |
getJdkVersion(File javaHome)
Get the version of the Java version with its home directory in javaHome. |
static JdkVersion |
getJdkVersionFromJavaExecutable(File javaExecutable)
Get the version of the supplied Java executable. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static File getJdkExecutableOrNull(File javaHome,
String cmd,
String... extensions)
java or javac from the bin catalog of a Java installation. First, javaHome is searched,
then the PATH environment variable is searched.
Tip: The org.entityfs.support.io.OsPlatform class can be used to
check if the program is running on Windows or not.
javaHome - The Java home directory. If this is set to null,
the JAVA_HOME environment variable is used. If that is not set,
the system property java.home (pointing to the installation of
the currently running JVM) is used instead.cmd - The name of the command, e.g. javac-extensions - The list of file name extensions (no leading dot) that
the file might have, for instance "", "exe".
null if
the command was not found.
public static File getJdkExecutable(File javaHome,
String cmd,
String... extensions)
throws EntityNotFoundException
java or javac from a Java
installation. First, javaHome is searched, then the PATH
environment variable is searched.
Tip: The org.entityfs.support.io.OsPlatform class can be used to
check if the program is running on Windows or not.
javaHome - The Java home directory. If this is set to null,
the JAVA_HOME environment variable is used. If that is not set,
the system property java.home (pointing to the installation of
the currently running JVM) is used instead.cmd - The name of the command, e.g. javac-extensions - The list of file name extensions (lo leading dot) that
the file might have, for instance "", "exe".
EntityNotFoundException - If the command was not found.
public static File getJdkExecutable(String cmd,
String... extensions)
throws EntityNotFoundException
java or javac from the default
Java installation. First, the directory under the JAVA_HOME
environment variable is searched, if it is set, then the PATH
environment variable is searched.
Tip: The org.entityfs.support.io.OsPlatform class can be used to
check if the program is running on Windows or not.
cmd - The name of the command, e.g. javac-extensions - The list of file name extensions (lo leading dot) that
the file might have, for instance "", "exe".
EntityNotFoundException - If the command was not found.
public static File getJdkFileOrNull(File javaHome,
String relPath)
javaHome, the PATH environment variable
is searched for a java command, and, if found, that Java
installation is searched for the file.
javaHome - The Java home directory. If this is set to null,
the JAVA_HOME environment variable is used. If that is not set,
the system property java.home (pointing to the installation of
the currently running JVM) is used instead.relPath - The path of the file, relative to the Java installation.
null if the file is not found.public static File getJdkFileOrNull(String relPath)
JAVA_HOME
environment variable is set, that is used to find a Java installation.
Otherwise the java.home (pointing to the path of the currently
running JVM) is used.
See getJdkFileOrNull(File, String) for more details.
relPath - The path of the file relative to the Java installation.
null if it was not found.
public static File getJdkFile(File javaHome,
String relPath)
throws EntityNotFoundException
jre/lib/rt.jar. See
getJdkFileOrNull(File, String)
javaHome - The Java home directory. If this is set to null,
the JAVA_HOME environment variable is used. If that is not set,
the system property java.home (pointing to the installation of
the currently running JVM) is used instead.relPath - The path of the file relative to the Java installation.
EntityNotFoundException - If the file is not found
public static File getJdkFile(String relPath)
throws EntityNotFoundException
getJdkFileOrNull(File, String)
.
relPath - The path of the file relative to the Java installation
EntityNotFoundException - If the file is not found
public static JdkVersion getJdkVersion(File javaHome)
throws InterruptedException
javaHome.
javaHome - The home directory of the Java installation.
javaHome.
InterruptedExceptiongetJdkVersion(),
getJdkVersionFromJavaExecutable(File)
public static JdkVersion getJdkVersion()
throws InterruptedException
JAVA_HOME environment variable is set, that is used to find a Java
installation. Otherwise the java.home (pointing to the path of
the currently running JVM) is used.
InterruptedExceptiongetJdkVersion(File),
getJdkVersionFromJavaExecutable(File)
public static JdkVersion getJdkVersionFromJavaExecutable(File javaExecutable)
throws InterruptedException
javaExecutable - A Java executable such as java.exe on
Windows.
InterruptedExceptiongetJdkVersion(File),
getJdkVersion()public static JdkVersion getCurrentJdkVersion()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||