From 0ad20c04752dcf9b5d50b639201c2c71af22bd4b Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Mon, 12 Dec 2016 14:57:43 -0800 Subject: Unix script template: get java version through java command --- src/compiler/scala/tools/ant/templates/tool-unix.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl index b5a238f7be..f35dbd86ed 100755 --- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl @@ -198,8 +198,8 @@ fi if [[ "$usebootcp" == "true" ]]; then classpath_args=("-Xbootclasspath/a:$TOOL_CLASSPATH" -classpath "\"\"") # Note that the version numbers go 1.7, 1.8, 9, 10, ... - java_release="$(cat $JAVA_HOME/release | grep JAVA_VERSION)" - if [[ ! "$java_release" =~ JAVA_VERSION=\"1\. ]]; then + java_release="$($JAVACMD -version 2>&1 | head -n 1 | sed 's/.* version \"\(.*\)\"/\1/g')" + if [[ ! "$java_release" =~ 1\. ]]; then # Java 9 removed sun.boot.class.path, and the supposed replacement to at least see # the appended boot classpath (jdk.boot.class.path.append) is not visible. # So we have to pass a custom system property that PathResolver will find. -- cgit v1.2.3