score:12

Accepted answer

This question puts me on the way

so I check the JDK version and surprisingly IntelliJ and Nailgun didn't run with the same JDK.

~ ❯❯❯ ps -ef | grep java
  501  2290  2017   0  4:12PM ??         0:01.81 /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/bin/java … org.jetbrains.plugins.scala.nailgun.NailgunRunner 3200 6a73f540-1a80-476d-96d2-83ab8faaad95
  501  2291  2017   0  4:12PM ??         0:02.15 /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/bin/java …

So I searched in the IntelliJ preferences and found out that Scala Compile Server was configured with an old JDK : 1.8.0_11. Bim !

I've just unchecked the checkbox Use external compile server

score:0

Note that in scala-2.12, scala binary file is a wrapper script.

It looks like your JAVA_HOME directory is not correctly set.

Take a look at line that reads (inside $SCALA_HOME/bin/scala):

java_release="$(cat $JAVA_HOME/release | grep JAVA_VERSION)"

Based on your output, it looks like JAVA_HOME is not set. What you get is:

cat: /release: No such file or directory

score:0

Late to the party but another possible solution for someone for whom the above answers are not working:

  1. Right click on your project and select module settings (for mac the shortcut is usually CMD + down arrow key)
  2. in the sidebar select Global libraries
  3. make sure that the correct scala SDK version is present. if not delete the existing one with the - button and add the correct sdk corresponding to the scala version in your pom.xml/ build.sbt using + button

a mismatch of scala version that intellij provides and the one defined by you in your build file can also cause this error.

score:1

go to editconfiguration in intellij and choose in JRE drop down the jdk version which is installed in your system. and do rebuild, It worked for me.


Related Query

More Query from same tag