Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple scala libraies causing error in intellij?

I am using intellij 14 with scala 2.11.6 installed using home brew and symlink using

ln -s /usr/local/Cellar/scala/2.11.6/libexec/src /usr/local/Cellar/scala/2.11.6/src ln -s /usr/local/Cellar/scala/2.11.6/libexec/lib  /usr/local/Cellar/scala/2.11.6/lib mkdir -p /usr/local/Cellar/scala/2.11.6/doc/scala-devel-docs ln -s /usr/local/Cellar/scala/2.11.6/share/doc/scala /usr/local/Cellar/scala/2.11.6/doc/scala-devel-docs/api 

I tried running a simple hello world but run into the following issue.

Error:scalac: Multiple 'scala-library*.jar' files (scala-library.jar, scala-library.jar, scala-library.jar) in Scala compiler classpath in Scala SDK scala-sdk-2.11.6 

Edit:

So I check the compiler class path on global libraries and apparently there are multiple scal-library.jar

file:///usr/local/Cellar/scala/2.11.6/idea/lib/scala-library.jar file:///usr/local/Cellar/scala/2.11.6/lib/scala-library.jar file:///usr/local/Cellar/scala/2.11.6/libexec/lib/scala-library.jar 

Does anyone know why?

like image 303
Kevin Avatar asked Apr 07 '15 10:04

Kevin


2 Answers

Maybe you have used

/usr/local/Cellar/scala/2.11.6/ 

as the path for Scala SDK?

When you install scala with homebrew that path will contain not only the scala libraries, but also a symlink with the relevant libraries for intellij. So if you use the top-level install directory intellij will find the libraries twice.

Instead you should use

/usr/local/Cellar/scala/2.11.6/idea/lib 
like image 56
Niels Avatar answered Sep 23 '22 09:09

Niels


I had the same issue than you experimented and the solution, actually very easy, was actually erasing the .idea folder from the project, the problem is that the configuration inside of this folder (containing the set ups for example for the test, VCS, the runs, etc) gets corrupted with double entries (probably cos you update your Scala version), once you do this and reopen the project in Intellij the IDEA will generate a fresh new configuration for you.

like image 45
legramira Avatar answered Sep 25 '22 09:09

legramira