Skip to content

Commit 99b4253

Browse files
committed
[backport] S-10098 Fix regression in Unix runner script with JAVA_HOME unset
Rework bfa7ade to unconditionally set the system property with the contents of the bootclasspath, rather than trying to do this only for JVM 9+. The attempted JVM version detection code assumed JAVA_HOME was set, which isn't always the case. (cherry picked from commit 60ea98e)
1 parent 961041f commit 99b4253

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/compiler/scala/tools/ant/templates/tool-unix.tmpl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,11 @@ fi
197197
# to java to suppress "." from materializing.
198198
if [[ "$usebootcp" == "true" ]]; then
199199
classpath_args=("-Xbootclasspath/a:$TOOL_CLASSPATH" -classpath "\"\"")
200-
# Note that the version numbers go 1.7, 1.8, 9, 10, ...
201-
java_release="$(cat $JAVA_HOME/release | grep JAVA_VERSION)"
202-
if [[ ! "$java_release" =~ JAVA_VERSION=\"1\. ]]; then
203-
# Java 9 removed sun.boot.class.path, and the supposed replacement to at least see
204-
# the appended boot classpath (jdk.boot.class.path.append) is not visible.
205-
# So we have to pass a custom system property that PathResolver will find.
206-
classpath_args+=("-Dscala.boot.class.path=$TOOL_CLASSPATH")
207-
fi
200+
# Java 9 removed sun.boot.class.path, and the supposed replacement to at least see
201+
# the appended boot classpath (jdk.boot.class.path.append) is not visible.
202+
# So we have to pass a custom system property that PathResolver will find.
203+
# We do this for all JVM versions, rather than getting into the business of JVM version detection.
204+
classpath_args+=("-Dscala.boot.class.path=$TOOL_CLASSPATH")
208205
else
209206
classpath_args=(-classpath "$TOOL_CLASSPATH")
210207
fi

0 commit comments

Comments
 (0)