Reputation: 451
I have openjdk, scala and sbt, all installed via brew. I'm trying to get setup to work on the scala track on exercism. I'm having no troubles with Java or anything that uses the JVM like clojure, but when I try to test my installation of scala by running the test for the exercism hello example:
$ sbt test
I get a bunch of errors that seem to start with this:
java.io.IOError: java.lang.RuntimeException: /packages cannot be represented as URI
My installed versions are as follows:
$ java --version
openjdk 13.0.1 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.1+9, mixed mode, sharing)
$ scala -version
Scala code runner version 2.13.1 --
$ sbt --version
sbt version in this project: 1.3.8
sbt script version: 1.3.8
I've looked and seen this error in a few questions but not seen a way to fix it.
Upvotes: 44
Views: 37794
Reputation: 1
XWZ's answer helped me too. Thanks.
Thought it was worth adding the compatibility chart here: https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html#scala-compatibility-table
I was using Scala 2.13.0, but using JDK 17, so got the error. Once I switched to JDK 8, REPL worked fine.
Upvotes: 0
Reputation: 11
What helped me here was:
File > Settings > Build, Execution, Deployment > Compiler > Scala Compile Server
Beside JDK, I set it to 1.8, built the application, issue was resolved.
Upvotes: 1
Reputation: 1
In my case, it is related to Intellij's Scala compile server settings.
go to settings -> Build, Exec... -> Compiler -> Scala Compile Server
uncheck use compile server
this solved the issue for me
Upvotes: 0
Reputation: 1
Settings -> Build, Execution, Deployment -> Scala Compiler -> Scala Compile Server work for me
Upvotes: 0
Reputation: 772
I found this S/O answer solves my issue:
This is a Scala compiler bug. Please upgrade to the latest Scala point release, 2.12.16.
Upvotes: 1
Reputation: 391
IntelliJ:
File -> Settings -> Build, Execution, Deployment -> Build Tools -> sbt
Use sbt shell for build
is checkedUpvotes: 0
Reputation: 29237
Intellij :
open Settings -> Build, Execution, Deployment -> Scala Compiler -> Scala Compile Server
, then change the JDK to the one your project used. This solution solved my problem.
Upvotes: 4
Reputation: 117
In my case, in Intellij IDEA, I had JAVA_HOME
as well as sbt JRE from the previous answer set to 1.8, but I completely forgot about the Project SDK, which was set to an incompatible version.
Ctrl + Alt + Shift + S > Project Settings > Project > Project SDK
Setting this to 1.8 as well as language levels of modules to 8 fixed my issues.
Upvotes: 6
Reputation: 111
I've got the same issue on IntelliJ IDEA and solved it with
Settings > Build, Exec... > Build Tools > sbt > JRE > set to 1.8.
JAVA_HOME
has not resolve it in my case
Upvotes: 11
Reputation: 763
I solved the issue by installing a java version of 1.8 and set JAVA_HOME towards this version.
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home"
Upvotes: 61