Reputation: 370
To start, I have reviewed the following response and am still struggling to resolve this issue:
Scala: packages cannot be represented as URI
I still see the following error output when I run sbt test
:
error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken
(class java.lang.NullPointerException/Cannot invoke "scala.tools.nsc.Global$Run.typerPhase()" because the return value of "scala.tools.nsc.Global.currentRun()" is null)
[error] java.io.IOError: java.lang.RuntimeException: /packages cannot be represented as URI
[error] at java.base/jdk.internal.jrtfs.JrtPath.toUri(JrtPath.java:176)
[error] at scala.tools.nsc.classpath.JrtClassPath.asURLs(DirectoryClassPath.scala:204)
[error] at scala.tools.nsc.classpath.AggregateClassPath.$anonfun$asURLs$1(AggregateClassPath.scala:55)
Here is what I'm seeing when I look and my build settings:
I checked my "/Library/
directory and I actually don't see a Java folder at all.
Upvotes: 2
Views: 4591
Reputation: 2527
Appears to be a compatibility issue with sbt version and java version.
I ran into a similar error when trying to import a sbt project using sbt version 1.2.7 (in project/build.properties) using openjdk 15
I found that project specified to use if I updated project/build.properties to sbt.version=1.4.7 the error would go away.
I also found I could use older jdk version openjdk 11 with sbt 1.2.7.
Screenshot seems to indicate you are using older version of java 8 and I think latest sbt requires at java 11+, so in your case I suggest upgrading java and trying again.
Upvotes: 1