+ private static final Platform p;
+
+ static {
+ float version;
+ try {
+ version = Float.parseFloat(System.getProperty("java.specification.version"));
+ } catch(Exception e) {
+ System.err.println("WARNING: " + e + " while trying to find jvm version - assuming 1.1");
+ version = 1.1f;
+ }
+ String platformClass;
+ if(version >= 1.4f) platformClass = "Jdk14";
+ else if(version >= 1.3f) platformClass = "Jdk13";
+ else if(version >= 1.2f) platformClass = "Jdk12";
+ else if(version >= 1.1f) platformClass = "Jdk11";
+ else throw new Error("JVM Specification version: " + version + " is too old. (see org.ibex.util.Platform to add support)");
+
+ try {
+ p = (Platform) Class.forName(Platform.class.getName() + "$" + platformClass).newInstance();
+ } catch(Exception e) {
+ e.printStackTrace();
+ throw new Error("Error instansiating platform class");
+ }
+ }