0

I'm running scala 2.8.0 SDK & Scala Plugin 1.5.2 (latest version) on IntelliJ 14.1.4 (also latest) with java-7-openjdk

object HelloWorld {
  def main(args: Array[String]) {
    println("Hello, world!")
  }
}

This is the error I'm receiving

Is there any settings i might have to change to get this to run? The program runs as a Scala Script on Idea IntelliJ

I must use scala 2.8.0 only not a later version, i'd be happy to change anything else

`Information:24/7/15 12:01 PM - Compilation completed with 1 error and 7 warnings in 30s 907ms
Error:scalac: Error: org.jetbrains.jps.incremental.scala.remote.ServerException
Error compiling sbt component 'compiler-interface-2.8.0.final-51.0'
    at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1$$anonfun$apply$2.apply(AnalyzingCompiler.scala:145)
    at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1$$anonfun$apply$2.apply(AnalyzingCompiler.scala:142)
    at sbt.IO$.withTemporaryDirectory(IO.scala:285)
    at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1.apply(AnalyzingCompiler.scala:142)
    at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1.apply(AnalyzingCompiler.scala:139)
    at sbt.IO$.withTemporaryDirectory(IO.scala:285)
    at sbt.compiler.AnalyzingCompiler$.compileSources(AnalyzingCompiler.scala:139)
    at sbt.compiler.IC$.compileInterfaceJar(IncrementalCompiler.scala:33)
    at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$.org$jetbrains$jps$incremental$scala$local$CompilerFactoryImpl$$getOrCompileInterfaceJar(CompilerFactoryImpl.scala:87)
    at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$$anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:44)
    at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$$anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:43)
    at scala.Option.map(Option.scala:145)
    at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.getScalac(CompilerFactoryImpl.scala:43)
    at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.createCompiler(CompilerFactoryImpl.scala:22)
    at org.jetbrains.jps.incremental.scala.local.CachingFactory$$anonfun$createCompiler$1.apply(CachingFactory.scala:24)
    at org.jetbrains.jps.incremental.scala.local.CachingFactory$$anonfun$createCompiler$1.apply(CachingFactory.scala:24)
    at org.jetbrains.jps.incremental.scala.local.Cache$$anonfun$getOrUpdate$2.apply(Cache.scala:20)
    at scala.Option.getOrElse(Option.scala:120)
    at org.jetbrains.jps.incremental.scala.local.Cache.getOrUpdate(Cache.scala:19)
    at org.jetbrains.jps.incremental.scala.local.CachingFactory.createCompiler(CachingFactory.scala:23)
    at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:22)
    at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:62)
    at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:20)
    at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)
Warning:scalac: /tmp/sbt_3f4b2dad/compiler-interface-sources/CompilerInterface.scala:161: error: object creation impossible, since method registerTopLevelSym in trait GlobalCompat of type (sym: this.Symbol)Unit is not defined
Warning:scalac:             new Compiler() with RangePositions // unnecessary in 2.11
Warning:scalac:                             ^
Warning:scalac: /tmp/sbt_3f4b2dad/compiler-interface-sources/CompilerInterface.scala:165: error: class Compiler needs to be abstract, since method registerTopLevelSym in trait GlobalCompat of type (sym: Compiler.this.Symbol)Unit is not defined
Warning:scalac:     class Compiler extends CallbackGlobal(command.settings, dreporter, output)
Warning:scalac:               ^
Warning:scalac: two errors found
wolfgang
  • 7,281
  • 12
  • 44
  • 72

3 Answers3

0

Try with scala 2.11.7 or 2.10.5 http://www.scala-lang.org/download/

al32
  • 109
  • 3
0

Out of curiosity, have you tried to use a different JDK? Maybe JDK6 Hotspot or even JDK7 Hotspot?
I ask because I have seen errors similar to Error compiling sbt component 'compiler-interface-2.8.0.final-51.0' in the past, and they were usually related to incompatibilities with a library and a JDK version.

I cannot test right now, but I will give a look later and try to reproduce if it is still an issue.

mdm
  • 3,928
  • 3
  • 27
  • 43
0

For future travellers also setting up Scala for the first time:

I had similar issues and found changing the "Project Interpreter" to the correct JDK (OpenJDK 11 instead of my previous JDK 8) worked.

See e.g. https://stackoverflow.com/a/29286865/10447904

Many other SO answers that I stumbled across focused on setting the correct JDK using Settings -> Build -> Scala Compiler Server or on the configuration files, but neither of these worked for me.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Lood van Niekerk
  • 833
  • 1
  • 6
  • 5