NoClassDefFoundError的使用Scala Eclipse插件 [英] noClassDefFoundError using Scala Plugin for Eclipse

查看:236
本文介绍了NoClassDefFoundError的使用Scala Eclipse插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功实施并使用Scala的插件跑了好几家斯卡拉教程在Eclipse中。然后,突然我试图编译和运行一个例子,这个错误想出了:

 异常线程mainjava.lang.NoClassDefFoundError的:你好/的HelloWorld
抛出java.lang.ClassNotFoundException:引起hello.HelloWorld
 在java.net.URLClassLoader的$ 1.run(URLClassLoader.java:200)
 在java.security.AccessController.doPrivileged(本机方法)
 在java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 在java.lang.ClassLoader.loadClass(ClassLoader.java:315)
 在sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:330​​)
 在java.lang.ClassLoader.loadClass(ClassLoader.java:250)
 在java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)

这一点后,我再也不能在Eclipse中运行的Scala程序。我试图清理和重建我的项目,关闭并重新打开我的项目,和关闭并重新打开Eclipse中。

Eclipse版本号3.5.2和Scala插件2.8.0

下面是原来的code:

 包你好对象的HelloWorld {
 高清主(参数:数组[字符串]){
  的println(世界你好)
 }
}


解决方案

如果你看到这个当您试图为斯卡拉应用程序运行,那么最有可能的解释是,你的项目没有编译并没有产生类文件。请检查是否是这样的话:看在你好/ HelloWorld.class的项目的输出文件夹

如果您的项目没有进行编译,可能要么是因为有你已经错过了一个错误(如果没有在问题被报告这个错误查看这可能是一个错误,在这种情况下,请开出罚单在Trac的),或者,因为你已经关闭了自动构建,而不是做你的项目的手工打造。

I successfully implemented and ran several Scala tutorials in Eclipse using the Scala plugin. Then suddenly I tried to compile and run an example, and this error came up:

Exception in thread "main" java.lang.NoClassDefFoundError: hello/HelloWorld
Caused by: java.lang.ClassNotFoundException: hello.HelloWorld
 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)

After this point I could no longer run any Scala programs in Eclipse. I tried cleaning and rebuilding my project, closing and reopening my project, and closing and reopening Eclipse.

Eclipse version number 3.5.2 and Scala plugin 2.8.0

Here is the original code:

package hello

object HelloWorld {
 def main(args: Array[String]){
  println("hello world")
 }
}

解决方案

If you see this when you attempt to run as a Scala application then the most likely explanation is that your project didn't compile and no class files were generated. Please check whether or not that's the case: look in your project's output folder for hello/HelloWorld.class.

If your project didn't compile that could either be because there's an error which you've missed (and if this error isn't being reported in the Problems view that could be a bug, in which case please open a ticket on Trac) or because you've turned off automatic builds and not done a manual build of your project.

这篇关于NoClassDefFoundError的使用Scala Eclipse插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆