Netbeans - 错误:无法找到或加载主类 [英] Netbeans - Error: Could not find or load main class
问题描述
所以我在 Neatbeans 7.4 中制作了一个 Java 应用程序,已经工作了一段时间,一切都很好,运行项目工作正常,但是现在当我点击运行项目时,我收到错误
So I'm making a java application in Neatbeans 7.4, been working at it for a while, everything was fine, running the project worked fine, but now when I hit run project, I get the error
Error: Could not find or load main class phleveledit.MainWindow
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
我想不出在这开始发生之前我做了什么,所以我不知道我应该改变什么..代码似乎没有任何错误.这是IDE+项目文件夹的截图
I can't think of what I did right before this started happening, so I don't know what I should change.. The code doesn't appear to have any errors. Here's a screenshot of the IDE+project folder
图片(http://puu.sh/5ldYB):
有什么想法吗?
不幸的是,我通过删除一些代码来解决这个问题,这些代码可能有一些 Netbeans 无法检测到的错误,但我不知道究竟是什么错误,所以无法对正确答案进行投票.
Unfortunately I happened to fix this problem by removing some code, which probably had some errors Netbeans couldn't detect, but I don't know what was exactly wrong so can't vote on a correct answer.
推荐答案
- 在项目资源管理器中右键单击您的项目
- 点击属性
- 点击运行
- 确保您的主类是您想要作为入口点的类.(确保使用完全限定名称,即 mypackage.MyClass)
- 点击确定.
- 清理构建您的项目
- 运行项目:)
如果您只想运行文件,请在包资源管理器中右键单击该类,然后单击运行文件,或 (Alt + R, F) 或 (Shift + F6)
If you just want to run the file, right click on the class from the package explorer, and click Run File, or (Alt + R, F), or (Shift + F6)
这篇关于Netbeans - 错误:无法找到或加载主类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!