How to get rid of scalac ServerException with IntelliJ Idea

前端 未结 3 1151
后悔当初
后悔当初 2021-02-19 10:05

This error prevents me from running the project.

Here are versions info :

~ ❯❯❯ java -version
java version \"1.8.0_45\"
Java(TM) SE Runtime Environment (         


        
相关标签:
3条回答
  • 2021-02-19 10:18

    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
    
    0 讨论(0)
  • 2021-02-19 10:20

    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

    0 讨论(0)
  • 2021-02-19 10:27

    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.

    0 讨论(0)
提交回复
热议问题