public final class JVM
extends java.lang.Object
A collection of static methods for getting Java Virtual Machine information, in particular, for JVM version control.
This class can be executed since JVM 1.0 and can be compiled since JDK 1.1
Modifier and Type | Class and Description |
---|---|
static class |
JVM.CannotCheckStackTrace |
Modifier and Type | Field and Description |
---|---|
static boolean |
JAVA_11_REFLECTION_SUPPORTED
True if
JAVA_11_SERIALIZATION_SUPPORTED is true and
the call Class.forName("java.lang.reflect.Method") works
without exception. |
static boolean |
JAVA_11_SERIALIZATION_SUPPORTED
True if Integer class implements an interface named "java.io.Serializable".
|
static boolean |
JAVA_12_COLLECTIONS_SUPPORTED
True if all
JAVA_11_SERIALIZATION_SUPPORTED ,
JAVA_11_REFLECTION_SUPPORTED and JAVA_12_COMPARABLE_SUPPORTED
constants are true and if Java 2 collections (java.util.Map ,
java.util.HashMap , etc.) are found. |
static boolean |
JAVA_12_COMPARABLE_SUPPORTED
True if both
JAVA_11_SERIALIZATION_SUPPORTED and
JAVA_11_REFLECTION_SUPPORTED constants are true and if
Integer class implements an interface named "java.lang.Comparable". |
Modifier and Type | Method and Description |
---|---|
static boolean |
isInInstanceInitialization(java.lang.Class clazz) |
static boolean |
isInMethod(java.lang.Class clazz,
java.lang.String methodName) |
static boolean |
isInStaticInitialization(java.lang.Class clazz) |
static java.lang.String |
toJavaClassName(java.lang.Object o) |
static java.lang.String |
toJavaName(java.lang.Class clazz,
boolean dollarsToDotsInNestedClasses) |
public static final boolean JAVA_11_SERIALIZATION_SUPPORTED
Can be used to detect Java 1.1 compatibility.
public static final boolean JAVA_11_REFLECTION_SUPPORTED
JAVA_11_SERIALIZATION_SUPPORTED
is true and
the call Class.forName("java.lang.reflect.Method")
works
without exception.
Can be used to detect Java 1.1 compatibility with more assurance than
JAVA_11_SERIALIZATION_SUPPORTED
.
public static final boolean JAVA_12_COMPARABLE_SUPPORTED
JAVA_11_SERIALIZATION_SUPPORTED
and
JAVA_11_REFLECTION_SUPPORTED
constants are true and if
Integer class implements an interface named "java.lang.Comparable".
Can be used to detect Java 1.2 compatibility.
public static final boolean JAVA_12_COLLECTIONS_SUPPORTED
JAVA_11_SERIALIZATION_SUPPORTED
,
JAVA_11_REFLECTION_SUPPORTED
and JAVA_12_COMPARABLE_SUPPORTED
constants are true and if Java 2 collections (java.util.Map
,
java.util.HashMap
, etc.) are found.
Can be used to detect Java 1.2 compatibility with more assurance than
JAVA_12_COMPARABLE_SUPPORTED
.
public static java.lang.String toJavaName(java.lang.Class clazz, boolean dollarsToDotsInNestedClasses)
public static java.lang.String toJavaClassName(java.lang.Object o)
public static boolean isInInstanceInitialization(java.lang.Class clazz) throws JVM.CannotCheckStackTrace
JVM.CannotCheckStackTrace
public static boolean isInStaticInitialization(java.lang.Class clazz) throws JVM.CannotCheckStackTrace
JVM.CannotCheckStackTrace
public static boolean isInMethod(java.lang.Class clazz, java.lang.String methodName) throws JVM.CannotCheckStackTrace
JVM.CannotCheckStackTrace