Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sbt fails with java.lang.NoClassDefFoundError: sbt/ConsoleOut$

Tags:

scala

ubuntu

sbt

After using sbt for some time, something failed and I can't run sbt on my Ubuntu machine. I get this exception no matter what I do. Even running sbt help causes the following error:

java.lang.NoClassDefFoundError: sbt/ConsoleOut$
    at sbt.StandardMain$.<init>(Main.scala:52)
    at sbt.StandardMain$.<clinit>(Main.scala)
    at sbt.xMain.run(Main.scala:26)
    at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
    at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
    at xsbt.boot.Launch$.run(Launch.scala:57)
    at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
    at xsbt.boot.Launch$.launch(Launch.scala:65)
    at xsbt.boot.Launch$.apply(Launch.scala:16)
    at xsbt.boot.Boot$.runImpl(Boot.scala:32)
    at xsbt.boot.Boot$.main(Boot.scala:21)
    at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.ClassNotFoundException: sbt.ConsoleOut$
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 12 more
Error during sbt execution: java.lang.NoClassDefFoundError: sbt/ConsoleOut$

I reinstalled the JDK and of course sbt, but it didn't help. The only thing I remember doing was installing the new IntelliJ IDEA 13. Could this be related?

like image 285
YaDa Avatar asked Dec 22 '13 08:12

YaDa


3 Answers

the only thing I remember doing was installing the new intellij (v13). Is this related?

It could be related.

Try:

rm -rf ~/.ivy/cache
mv ~/.sbt ~/.sbt.old
like image 98
Robin Green Avatar answered Oct 25 '22 04:10

Robin Green


Most probably this issue comes from the IntelliJ IDE, Close all the running processes of the IDE and start it again.

like image 24
noelyahan Avatar answered Oct 25 '22 05:10

noelyahan


In sbt:

clean

Results in re-resolution of ivy artifacts on next compile, without having to clear the ivy cache.

If the ivy itself is the problem then above solution is a good fallback.

like image 3
user5787082 Avatar answered Oct 25 '22 04:10

user5787082