Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "Internal error: Scala instance doesn't exist or is invalid" when trying to run a worksheet in IntelliJ IDEA

Tags:

scala

ubuntu

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.

like image 945
Ashok Bhaskar Avatar asked Oct 22 '17 21:10

Ashok Bhaskar


1 Answers

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.

like image 91
marco Avatar answered Oct 13 '22 22:10

marco