IntelliJ Bug: Scala 145, Error:scalac: Scala compiler JARs not found
Solution 1
Please goto File > Settings (Ctrl+Alt+S, Windows)/Preferences (Mac) > Plugin Search for "scala". Uninstall Scala plugin.. Restart IDE. Reinstall it. Restart IDE and install the plugin. Everything works OK
Solution 2
In the more recent versions of IntelliJ (2020.1.1) at the time of writing this, I was able to solve this problem by removing the Scala SDK configured in the Global Libraries
section in IntelliJ and hitting File > Invalid Caches / Restart
.
I'm not sure why this solved the issue, perhaps recent versions of the IDE now have automatic detection of Scala compiler JAR files from Maven (which I'm using to build my project).
Solution 3
If your project is Gradle-based, one possibility is that the project is looking for Scala libraries in the .m2 cache that don't exist. To confirm, open "Project Structure...", go to "Libraries", and examine the list for "Gradle: org.scala-lang:..." that contain errors related to missing files.
If this is the issue, simply re-import the project from scratch.
Solution 4
https://www.jetbrains.com/help/idea/invalidate-caches.html
IntelliJ IDEA caches a great number of files, therefore the system cache may become overloaded. Sometimes the caches will never be needed again, for example, if you work with frequent short-term projects.
When you invalidate the cache, IntelliJ IDEA rebuilds all projects ever run in the current version of the IDE.
Clear the system cache 1.From the main menu, select File | Invalidate Caches / Restart.
2.In the Invalidate Caches dialog, select an action. You can invalidate the caches and restart the IDE or just restart the IDE.
This worked for me.
Solution 5
Open File -> Project Structure
Go to Libraries under Project Settings
Click on the minus button on the erroring Scala library
Open an existing Scala class in IntelliJ and you will see the prompt to set up Scala SDK and click on that
Admin
Updated on October 19, 2021Comments
-
Admin over 2 years
I try to compile a simple object in IntelliJ:
object Test02 { def main(args: Array[String]) { println("Hello World"); } }
I got this message:
Error:scalac: Scala compiler JARs not found (module 'scala02'): E:\.ivy2\cache\org.scala-lang\scala-library\jars\scala-library-2.11.8.jar, E:\.ivy2\cache\org.scala-lang\scala-compiler\jars\scala-compiler-2.11.8.jar, E:\.ivy2\cache\org.scala-lang\scala-reflect\jars\scala-reflect-2.11.8.jar
I checked the Project Structure and checked the modules. Modules are located here:
C:/Users/asus1/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.11.8.jar
How Can I change E: to C:/Users/asus1/ ?
Do I need to move all to E: ?How people manage when the project and the jar are in different location ?
It seems a big bug of IntellJ ...?