YaDa
YaDa

Reputation: 1273

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

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?

Upvotes: 21

Views: 27092

Answers (5)

stackoverflowed
stackoverflowed

Reputation: 917

Alternatively, it could be that your project uses a too old version of sbt, somehow breaking some dependencies. Update sbt.version in project/build.properties and it should work again.

Upvotes: 0

harikrishnasiliveri
harikrishnasiliveri

Reputation: 71

In windows, log with cygwin or any other terminal emulator and run below commands:

  1. rm -rf ~/.sbt
  2. rm -rf ~/.ivy2
  3. rm -rf ~/.ivy

Upvotes: 3

noelyahan
noelyahan

Reputation: 4245

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

Upvotes: 6

user5787082
user5787082

Reputation: 31

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.

Upvotes: 3

Robin Green
Robin Green

Reputation: 33033

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

Upvotes: 41

Related Questions