Skip to content

Commit b2650ef

Browse files
committed
better detection of JDK 9 and JDK 10
1 parent ffbccfa commit b2650ef

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

visualvm/jvm/src/com/sun/tools/visualvm/jvm/JVMImpl.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,28 @@ public boolean is15() {
191191

192192
public boolean is16() {
193193
String ver = getJavaVersion();
194-
if (ver != null && (ver.startsWith("1.6.") || ver.startsWith("10.") || ver.startsWith("11."))) { // NOI18N
195-
return true;
194+
if (ver != null) {
195+
if (ver.startsWith("1.6.")) { // NOI18N
196+
return true;
197+
}
198+
// HotSpot Express, only vmVersion available
199+
if (javaVersion == null && (ver.startsWith("10.") || ver.startsWith("11."))) { // NOI18N
200+
return true;
201+
}
196202
}
197203
return false;
198204
}
199205

200206
public boolean is17() {
201207
String ver = getJavaVersion();
202-
if (ver != null && (ver.startsWith("1.7.") || ver.startsWith("12.") || ver.startsWith("13.") || ver.startsWith("14."))) { // NOI18N
203-
return true;
208+
if (ver != null) {
209+
if (ver.startsWith("1.7.")) { // NOI18N
210+
return true;
211+
}
212+
// HotSpot Express, only vmVersion available
213+
if (javaVersion == null && (ver.startsWith("12.") || ver.startsWith("13.") || ver.startsWith("14."))) { // NOI18N
214+
return true;
215+
}
204216
}
205217
return false;
206218
}
@@ -215,15 +227,15 @@ public boolean is18() {
215227

216228
public boolean is19() {
217229
String ver = getJavaVersion();
218-
if (ver != null && (ver.startsWith("1.9.") || (ver.startsWith("9")))) { // NOI18N
230+
if (ver != null && javaVersion != null && (ver.startsWith("1.9.") || (ver.equals("9")) || (ver.startsWith("9.")))) { // NOI18N
219231
return true;
220232
}
221233
return false;
222234
}
223235

224236
public boolean is100() {
225237
String ver = getJavaVersion();
226-
if (ver != null && (ver.startsWith("10"))) { // NOI18N
238+
if (ver != null && javaVersion != null && (ver.equals("10") || ver.startsWith("10."))) { // NOI18N
227239
return true;
228240
}
229241
return false;

0 commit comments

Comments
 (0)