scala sbt 失败,出现 java.lang.NoClassDefFoundError: sbt/ConsoleOut$
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20727647/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
sbt fails with java.lang.NoClassDefFoundError: sbt/ConsoleOut$
提问by YaDa
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 helpcauses the following error:
使用 sbt 一段时间后,有些事情失败了,我无法在我的 Ubuntu 机器上运行 sbt。无论我做什么,我都会得到这个例外。即使运行也会sbt help导致以下错误:
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.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.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.run(URLClassLoader.java:366)
at java.net.URLClassLoader.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?
我重新安装了 JDK,当然还有 sbt,但它没有帮助。我记得做的唯一一件事就是安装新的 IntelliJ IDEA 13。这有关系吗?
回答by Robin Green
the only thing I remember doing was installing the new intellij (v13). Is this related?
我记得做的唯一一件事就是安装新的 Intellij (v13)。这有关系吗?
It could be related.
它可能是相关的。
Try:
尝试:
rm -rf ~/.ivy/cache
mv ~/.sbt ~/.sbt.old
回答by noelyahan
Most probably this issue comes from the IntelliJ IDE, Close all the running processes of the IDE and start it again.
这个问题很可能来自 IntelliJ IDE,关闭 IDE 的所有正在运行的进程并重新启动它。
回答by user5787082
In sbt:
在 sbt:
clean
干净的
Results in re-resolution of ivy artifacts on next compile, without having to clear the ivy cache.
导致在下次编译时重新解析 ivy 工件,而无需清除 ivy 缓存。
If the ivy itself is the problem then above solution is a good fallback.
如果常春藤本身就是问题,那么上述解决方案是一个很好的后备方案。
回答by harikrishnasiliveri
In windows, log with cygwin or any other terminal emulator and run below commands:
在 Windows 中,使用 cygwin 或任何其他终端模拟器登录并运行以下命令:
rm -rf ~/.sbtrm -rf ~/.ivy2rm -rf ~/.ivy
rm -rf ~/.sbtrm -rf ~/.ivy2rm -rf ~/.ivy

