summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2016-12-12 14:57:43 -0800
committerJakob Odersky <jakob@odersky.com>2016-12-12 14:57:43 -0800
commit0ad20c04752dcf9b5d50b639201c2c71af22bd4b (patch)
tree135654324592b873380cd4b8d87ae36d2a0c1681
parent7ae0aec7a202b22ea427d504ad3a79c0998e4b8f (diff)
downloadscala-script-linux.tar.gz
scala-script-linux.tar.bz2
scala-script-linux.zip
Unix script template: get java version through java commandscript-linux
-rwxr-xr-xsrc/compiler/scala/tools/ant/templates/tool-unix.tmpl4
1 files 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.