.printStackTrace(System.err);
vmVersion = 1.5;
} else {
- try {
- String versionString = vm.substring(0, 3);
- Double temp = new Double(Double.parseDouble(versionString));
- vmVersion = temp.doubleValue();
- } catch (Exception e) {
- vmVersion = 1.4;
+ if (vm.startsWith("9")) {
+ // JDK 9 beta 99 starts using 9-ea as the version string.
+ vmVersion = 1.9;
+ } else {
+ try {
+ String versionString = vm.substring(0, 3);
+ Double temp = new Double(Double.parseDouble(versionString));
+ vmVersion = temp.doubleValue();
+ } catch (Exception e) {
+ vmVersion = 1.4;
+ }
}
}
} catch (Throwable t) {
public static boolean is18VMOrGreater() {
return 1.8 <= vmVersion;
}
+
+ public static boolean is19VMOrGreater() {
+ return 1.9 <= vmVersion;
+ }
/**
* Shorthand for "if null, throw IllegalArgumentException"