5
votes

I'm trying to get Scala set up for a Coursera course on Ubuntu, and I've followed their instructions by installing open-jdk 1.8, sbt (sbt about says v1.0.2), and IntelliJ Idea. I've set up an sbt project with a HelloWorld Scala worksheet in src/main/scala that just says "Hello, world", but when I try to evaluate the worksheet, I get the error

Internal error: Scala instance doesn't exist or is invalid: version unknown, library jar: /home/[my username]/.ivy2/cache/jline/jline/jars/jline-2.14.5.jar, compiler jar: /home/[my username]/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar

followed by a longer trace. Is there a setup step I'm missing? The project seems to point to Java v1.8 in the Project Structure dependencies, and in the "Libraries" tab I see SBT set to Scala v2.12.

2
Do you have a build.sbt file in your project's root directory? If so, what are its contents?Mike Allen
I have the same issue also. build.sbt contents are name := "EssentialScala" version := "0.1" scalaVersion := "2.12.4" IntelliJ version is 2017.2Damien O'Reilly
did you solved this?marco

2 Answers

7
votes

I've just had the same problem with macOS Sierra. I solved after noticing that in my build.sbt I had:

name := "myScalaTests"
version := "0.1"
scalaVersion := "2.12.4"

but prompting sbt about, my scala version was different.

sbt about
[warn] No sbt.version set in project/build.properties, base directory: /Users/myUser/projects
[info] Set current project to projects (in build file:/Users/myUser/projects/)
[info] This is sbt 1.0.2
[info] The current project is {file:/Users/myUser/projects/}projects 0.1-SNAPSHOT
[info] The current project is built against Scala 2.12.3
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, sbt.plugins.Giter8TemplatePlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.12.3

so I changed the version of scala in the build.sbt accordingly, ant it worked.

0
votes

The same internal error can be caused by a version mismatch between the sbt launcher and the project sbt version, as described here:

Internal error: Scala instance doesn't exist or is invalid

In my project, there was no scala version mismatch, but downloading the latest sbt launcher and restarting my session resolved the issue.