public final class JavaEnvUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
JAVA_1_0
Version constant for Java 1.0
|
static String |
JAVA_1_1
Version constant for Java 1.1
|
static String |
JAVA_1_2
Version constant for Java 1.2
|
static String |
JAVA_1_3
Version constant for Java 1.3
|
static String |
JAVA_1_4
Version constant for Java 1.4
|
static String |
JAVA_1_5
Version constant for Java 1.5
|
static String |
JAVA_1_6
Version constant for Java 1.6
|
static String |
JAVA_1_7
Version constant for Java 1.7
|
static String |
JAVA_1_8
Version constant for Java 1.8
|
static String |
JAVA_9
Version constant for Java 9
|
static int |
VERSION_1_0
Number Version constant for Java 1.0
|
static int |
VERSION_1_1
Number Version constant for Java 1.1
|
static int |
VERSION_1_2
Number Version constant for Java 1.2
|
static int |
VERSION_1_3
Number Version constant for Java 1.3
|
static int |
VERSION_1_4
Number Version constant for Java 1.4
|
static int |
VERSION_1_5
Number Version constant for Java 1.5
|
static int |
VERSION_1_6
Number Version constant for Java 1.6
|
static int |
VERSION_1_7
Number Version constant for Java 1.7
|
static int |
VERSION_1_8
Number Version constant for Java 1.8
|
static int |
VERSION_9
Number Version constant for Java 9
|
Modifier and Type | Method and Description |
---|---|
static File |
createVmsJavaOptionFile(String[] cmd)
Writes the command into a temporary DCL script and returns the
corresponding File object.
|
static String |
getJavaHome()
Return the value of ${java.home}
|
static String |
getJavaVersion()
Returns the version of Java this class is running under.
|
static String |
getJdkExecutable(String command)
Finds an executable that is part of a JDK installation based on
the java.home system property.
|
static String |
getJreExecutable(String command)
Finds an executable that is part of a JRE installation based on
the java.home system property.
|
static Vector<String> |
getJrePackages()
get a vector of strings of packages built into
that platforms runtime jar(s)
|
static Vector<String> |
getJrePackageTestCases()
Testing helper method; kept here for unification of changes.
|
static DeweyDecimal |
getParsedJavaVersion()
Returns the version of Java this class is running under.
|
static boolean |
isApacheHarmony()
Checks whether the current VM is Apache Harmony.
|
static boolean |
isAtLeastJavaVersion(String version)
Compares the current Java version to the passed in String -
assumes the argument is one of the constants defined in this
class.
|
static boolean |
isClasspathBased()
Checks whether the current Java VM is GNU Classpath
|
static boolean |
isGij()
Checks whether the current Java VM is the GNU interpreter gij
or we are running in a gcj precompiled binary.
|
static boolean |
isJavaVersion(String version)
Compares the current Java version to the passed in String -
assumes the argument is one of the constants defined in this
class.
|
static boolean |
isKaffe()
Checks whether the current Java VM is Kaffe.
|
public static final String JAVA_1_0
public static final String JAVA_1_1
public static final String JAVA_1_2
public static final String JAVA_1_3
public static final String JAVA_1_4
public static final String JAVA_1_5
public static final String JAVA_1_6
public static final String JAVA_1_7
public static final String JAVA_1_8
public static final String JAVA_9
public static final int VERSION_1_0
public static final int VERSION_1_1
public static final int VERSION_1_2
public static final int VERSION_1_3
public static final int VERSION_1_4
public static final int VERSION_1_5
public static final int VERSION_1_6
public static final int VERSION_1_7
public static final int VERSION_1_8
public static final int VERSION_9
public static File createVmsJavaOptionFile(String[] cmd) throws IOException
cmd
- the command.IOException
- if there is an error writing to the file.public static String getJavaHome()
public static String getJavaVersion()
Up until Java 8 Java version numbers were 1.VERSION - e.g. 1.8.x for Java 8, starting with Java 9 it became 9.x.
public static String getJdkExecutable(String command)
You typically find them in JAVA_HOME/bin
if
JAVA_HOME
points to your JDK installation.
command
- the java executable to find.public static String getJreExecutable(String command)
java
, keytool
,
policytool
, orbd
, rmid
,
rmiregistry
, servertool
and
tnameserv
are JRE executables on Sun based
JRE's.
You typically find them in JAVA_HOME/jre/bin
if
JAVA_HOME
points to your JDK installation. JDK
< 1.2 has them in the same directory as the JDK
executables.
command
- the java executable to find.public static Vector<String> getJrePackages()
public static Vector<String> getJrePackageTestCases()
public static DeweyDecimal getParsedJavaVersion()
This number can be used for comparisons.
public static boolean isApacheHarmony()
public static boolean isAtLeastJavaVersion(String version)
JAVA_1_0
through
JAVA_1_4
need no longer be tested for.version
- the version to check against the current version.public static boolean isClasspathBased()
public static boolean isGij()
public static boolean isJavaVersion(String version)
JAVA_1_0
through
JAVA_1_4
need no longer be tested for.version
- the version to check against the current version.public static boolean isKaffe()