如何调试 Eclipse 构建?
大家好:调试 eclipse 中的“classnotfound”错误的最佳方法是什么?
我有一个标准设置......Ant、Eclipse 等......每隔一段时间,我就会做一些事情来搞乱我的构建。我从来没有完全想出一个系统来准确地弄清楚 Eclipse 在哪里“查找”类文件 --- 以及如何确保我的构建正常工作。
通常,在这个项目中,我会打开和关闭“构建器”(属性 -> 构建器中有一个 Java 构建器和 Ant 构建器复选框),并使用 ant 从命令行构建几次 --- 最终, eclipse 同步备份并看到我的类文件...
所以总的来说 - 我真正的问题是 - 在 eclipse 中检查和调试 java 构建的正确方法是什么?当您单击“Run As-> Junit test”时... Eclipse 如何以及在哪里查找/执行类?
Hi guys : Whats the best way to debug the "classnotfound" Error in eclipse ?
I have a standard setup .... Ant, eclipse, etc... and every once in a while, I do something to muck my build up . I've never quite come up with a system for figuring out exactly where it is that eclipse "looks" for class files --- and how to make sure that my builds work properly.
Usually, on this project, I toggle the "builders" on and off (there is a Java builder, and an Ant builder checkbox in Properties->Builders), and build from the commandline using ant a few times --- eventually, eclipse gets synced back up and sees my class files....
So in general - my real question is - what is the right way to inspect and debug a java build in eclipse ? When you click "Run As-> Junit test" ... how and where does eclipse look for / execute the classes ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该检查您的项目类路径。
通常java使用它的本机类路径(Java Home和当前目录)。然而 Eclipse 使用项目的类路径覆盖它。您必须手动将任何外部库添加到项目类路径中。
这是应该做什么的一个很好的介绍: http://www.ehow.com/ how_4784820_set-classpath-eclipse.html
You should check your project classpath.
Usually java uses it's native classpath (Java Home and current directory). However eclipse overrides that with the project's classpath. You have to manually add any external libraries to the projects classpath.
This is a good intro to what should be done: http://www.ehow.com/how_4784820_set-classpath-eclipse.html
我还没有使用过它,但是 eclipse 中有一个 ant 调试器 http:// /www.ibm.com/developerworks/opensource/tutorials/os-ecl-easyant/
I haven't used it but there's an ant debugger within eclipse http://www.ibm.com/developerworks/opensource/tutorials/os-ecl-easyant/
调试eclipse中的“classnotfound”错误。
您可以尝试两种解决方案1)转到项目->清理->清理所有项目
(如果错误是由于您开发的文件引起的)。
2) 检查项目的类路径,确保类路径中存在包含您收到“classnotfound”错误的类的 jar 文件。
To debug the "classnotfound" Error in eclipse.
You can try two solutions 1) go to projects->clean -> cleanallprojects
( if error is due to the file that you developed).
2) Check the classpath of your project to make sure jar file containing class for which your are getting the "classnotfound" Error is there in your classpath.