Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm trying to compile a mixed java-scala code using intelliJ 14.1.4

but it keeps giving me this error:

Error Compiling SBT component 'compiler-interface-2.9.2-52.0'

I have tried to down grade my scala-compiler version but this didn't helped.

any help would be appreciated.

What versions of scala and sbt are you using? Looks like Scala 2.9.x so you could try upgrading to Scala 2.10. OP here had a similar problem with an older version: stackoverflow.com/questions/21497806/… – thwiegan Aug 6, 2015 at 9:34 Maybe your IntelliJ or the Project you are trying to compile still run on an older version. On your project you can check under Project Structure -> Global Libraries or in your build.sbt, if available – thwiegan Aug 6, 2015 at 9:42 I faced with the same issue. However by going back to JDK1.6.0_181, the issue remains. Anyone knows why? – chucklai Jul 24, 2021 at 5:34

To add to Amy's and other answers, there are three places where JDK is involved. The first two are in the Project Settings, the third is Settings -> Build, Execution, Deployment -> Compiler -> Scala Compiler -> Scala Compile Server (if enabled). If this problem arises, check these three are the same.

For people who don't want to click through, this is a reminder that the project JDK and run configuration both need to match (and be the right version for your project). Even 6 years later this was helpful... – cbmanica Sep 29, 2020 at 20:23 Once again, if you don't want to open images and search for settings, here are the steps---> Right click on your project name --> Click on 'Open Module Settings' --> Under project settings withing Project and Module change the setting back to JDK needed – Nav Oct 28, 2020 at 14:29

Make sure you have the JDK-1.8 set in the following places.

Project Settings -> Project -> Project SDK
Project Settings -> Modules -> Dependencies -> Module SDK 

Add/Select JDK-1.8 in

Project Settings -> SDKs

Make sure you have the JDK-1.8 set in the following places. Project Settings -> Project -> Project SDK Project Settings -> Modules -> Dependencies -> Module SDK Add/Select JDK-1.8 in

Project Settings -> SDKs

The first two are in the Project Settings, the third is Settings -> Build, Execution, Deployment -> Compiler -> Scala Compiler -> Scala Compile Server (if enabled). If this problem arises, check these three are the same.

Make Sure that Java versions are same every where,

Solved.

The issue was due to 2 different dependencies, which imported 2 different scala versions, and then scala 2.11 was compiled with scala 2.9 which led to the error.

maven dependencyManagement solved it for me

Indeed, the compilation already worked on the console but IntelliJ would not compile, and a re-import solved the issue for me. – Christoph Jul 17, 2017 at 15:19

Also, please make sure you are using compatible Scala and Jdk version. like - JDK-Scala Version compatibility table

Please refer - https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html

I met the same error when I run the old project https://github.com/dpp/simply_lift

it was from 2010.. I must revert my java to 1.7 and update the Scala version from 2.11.6 to 2.11.12 , add it to Project Settings-> Modules

Then I can start the project ...

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.