From 90032f9d1d3e97eaa305fb695a5030369e6031e6 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Wed, 29 May 2019 22:32:25 +0530 Subject: [PATCH] NP-44 Fix JAVA_VERSION property parsing for JDK 11 --- .../modules/payara/tooling/data/StartupArgsEntity.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/payara.tooling/src/org/netbeans/modules/payara/tooling/data/StartupArgsEntity.java b/payara.tooling/src/org/netbeans/modules/payara/tooling/data/StartupArgsEntity.java index 460ec77..6c682e2 100644 --- a/payara.tooling/src/org/netbeans/modules/payara/tooling/data/StartupArgsEntity.java +++ b/payara.tooling/src/org/netbeans/modules/payara/tooling/data/StartupArgsEntity.java @@ -196,8 +196,13 @@ public Version getJavaVersion() { if(javaVersion == null && javaHome != null) { try (BufferedReader bufferedReader = new BufferedReader(new FileReader(new File(javaHome, "release")));) { - String version = bufferedReader.readLine(); - javaVersion = JDK.getVersion(version.substring(version.indexOf("\"") + 1, version.lastIndexOf("\""))); + String line; + while ((line = bufferedReader.readLine()) != null) { + if (line.startsWith("JAVA_VERSION")) { + javaVersion = JDK.getVersion(line.substring(line.indexOf("\"") + 1, line.lastIndexOf("\""))); + break; + } + } } catch (IOException ex) { Exceptions.printStackTrace(ex); }