org.jboss.util.platform
public final class: Java [javadoc |
source]
java.lang.Object
org.jboss.util.platform.Java
Provides common access to specifics about the version of
Java
that a virtual machine supports.
Determines the version of the Java Virtual Machine by checking
for the availablity of version specific classes.
Classes are loaded in the following order:
- java.lang.StackTraceElement was introduced in JDK 1.4
- java.lang.StrictMath was introduced in JDK 1.3
- java.lang.ThreadLocal was introduced in JDK 1.2
- java.lang.Void was introduced in JDK 1.1
- version:
< - tt>$Revision: 1.3 $
- author:
< - a href="mailto:jason@planet57.com">Jason Dillon
| Field Summary |
|---|
| public static final int | VERSION_1_0 | Java version 1.0 token |
| public static final int | VERSION_1_1 | Java version 1.1 token |
| public static final int | VERSION_1_2 | Java version 1.2 token |
| public static final int | VERSION_1_3 | Java version 1.3 token |
| public static final int | VERSION_1_4 | Java version 1.4 token |
| Method from org.jboss.util.platform.Java Detail: |
public static int getVersion() {
// default to 1.0
int version = VERSION_1_0;
try {
// check for 1.1
Class.forName("java.lang.Void");
version = VERSION_1_1;
// check for 1.2
Class.forName("java.lang.ThreadLocal");
version = VERSION_1_2;
// check for 1.3
Class.forName("java.lang.StrictMath");
version = VERSION_1_3;
// check for 1.4
Class.forName("java.lang.StackTraceElement");
version = VERSION_1_4;
}
catch (ClassNotFoundException e) {
ThrowableHandler.add(e);
}
VERSION = version;
return VERSION;
}
Return the version of Java supported by the VM. |
public static boolean isCompatible(int version) {
// if our vm is the same or newer then we are compatible
return VERSION >= version;
}
Retrurns true if the current virtual machine is compatible with
the given version identifer. |
public static boolean isVersion(int version) {
return VERSION == version;
}
Retrurns true if the given version identifer is equal to the
version identifier of the current virtuial machine. |