Netbeans - 错误:无法找到或加载主类 [英] Netbeans - Error: Could not find or load main class

查看:66
本文介绍了Netbeans - 错误:无法找到或加载主类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在 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.

推荐答案

  1. 在项目资源管理器中右键单击您的项目
  2. 点击属性
  3. 点击运行
  4. 确保您的主类是您想要作为入口点的类.(确保使用完全限定名称,即 mypackage.MyClass)
  5. 点击确定.
  6. 清理构建您的项目
  7. 运行项目:)

如果您只想运行文件,请在包资源管理器中右键单击该类,然后单击运行文件,或 (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屋!

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