From 3cd4815fe479b93ed0c433480f9298c7334b7a39 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 1 Nov 2017 08:48:12 +1000 Subject: [PATCH] More general boot classpath discovery --- .../src/main/scala/sbt/compiler/CompilerArguments.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compile/src/main/scala/sbt/compiler/CompilerArguments.scala b/compile/src/main/scala/sbt/compiler/CompilerArguments.scala index df279bb37..df9bea371 100644 --- a/compile/src/main/scala/sbt/compiler/CompilerArguments.scala +++ b/compile/src/main/scala/sbt/compiler/CompilerArguments.scala @@ -45,7 +45,13 @@ final class CompilerArguments(scalaInstance: xsbti.compile.ScalaInstance, cp: xs /** Add the correct Scala library jar to the boot classpath if `addLibrary` is true.*/ def createBootClasspath(addLibrary: Boolean) = { - val originalBoot = System.getProperty("sun.boot.class.path", "") + def findBoot: String = { + import scala.collection.JavaConverters._ + System.getProperties.asScala.iterator.collectFirst { + case (k, v) if k.endsWith(".boot.class.path") => v + }.getOrElse("") + } + val originalBoot = System.getProperty("sun.boot.class.path", findBoot) if (addLibrary) { val newBootPrefix = if (originalBoot.isEmpty) "" else originalBoot + File.pathSeparator newBootPrefix + scalaInstance.libraryJar.getAbsolutePath