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

查看:369
本文介绍了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. 运行项目:)

  1. Right click on your Project in the project explorer
  2. Click on properties
  3. Click on Run
  4. Make sure your Main Class is the one you want to be the entry point. (Make sure to use the fully qualified name i.e. mypackage.MyClass)
  5. Click OK.
  6. Clean an build your project
  7. Run Project :)

如果您只想运行该文件,请右键单击包浏览器中的类,然后单击运行文件,或( 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天全站免登陆