Skip to content

Commit 92c9750

Browse files
authored
IVMInstall2 and IVMInstall3 report different java.version values #762 (#763)
IVMInstall2#getJavaVersion() implementation now includes the update release as well, including the '-' and '_' separators if any. #763
1 parent f05df38 commit 92c9750

File tree

1 file changed

+13
-6
lines changed
  • org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching

1 file changed

+13
-6
lines changed

org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVM.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,21 @@ public String getJavaVersion() {
5858
File executable = getJavaExecutable();
5959
if (executable != null) {
6060
String vmVersion = installType.getVMVersion(installLocation, executable);
61-
// strip off extra info
6261
StringBuilder version = new StringBuilder();
63-
for (int i = 0; i < vmVersion.length(); i++) {
62+
loop: for (int i = 0; i < vmVersion.length(); i++) {
6463
char ch = vmVersion.charAt(i);
65-
if (Character.isDigit(ch) || ch == '.') {
66-
version.append(ch);
67-
} else {
68-
break;
64+
switch (ch) {
65+
case '.':
66+
case '_':
67+
case '-':
68+
version.append(ch);
69+
break;
70+
default:
71+
if (Character.isDigit(ch)) {
72+
version.append(ch);
73+
break;
74+
}
75+
break loop;
6976
}
7077
}
7178
if (version.length() > 0) {

0 commit comments

Comments
 (0)