在 NetBeans 6.9 中找不到主类 [英] Can't find main class in NetBeans 6.9

查看:40
本文介绍了在 NetBeans 6.9 中找不到主类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我加载 NetBeans 6.9(以前的版本也发生类似的错误)时,我让 NetBeans 完成扫描我的项目,一旦完成,我尝试运行一个配置文件,该配置文件指向一个具有 main 方法的类,NetBeans 总是说 main没有找到类,即使它在错误弹出后显示在类列表中.

Whenever I load NetBeans 6.9 (similar errors happened on previous versions also) then I let NetBeans finish scanning my projects and once it's done I try to run a profile which points to a class with a main method, NetBeans always says the main class is not found, even though it shows up in the list of classes once the error pops up.

如果我从列表中选择类并点击确定,同样的错误再次发生(未找到主类).

If I select the class from the list and hit OK, the same error happens again (main class not found).

如果我编译主类,我仍然遇到同样的问题.

If I compile the main class, I still get the same problem.

如果我重建整个项目,我想我仍然会遇到同样的问题.-> 当我编译主项目时,它会编译所有项目,即使是那些关闭的项目.这是怎么回事?

I think I still get the same issue if I rebuild the entire project. -> when I compile the main project it compiles all projects, even those that are closed. What is going on?

到目前为止,我找到的唯一解决方法是关闭项目并重新打开它,然后等待项目扫描再次完成.

The only way I have found so far to work around this is to close the project and re-open it and wait for the project scan to finish again.

这太令人讨厌了.有没有办法解决这个问题?

This is incredibly annoying. Is there a fix for this?

我注意到的另一件奇怪的事情是我的项目似乎构建了错误的 JAR 文件名(尽管如果我执行上述关闭并重新打开项目的步骤,它仍然有效).我有两个不同名称的项目,即使在关闭另一个项目并重新启动 NetBeans 很多次之后,当我构建第一个项目时,它仍使用已关闭很长时间的第二个项目的 JAR 文件名.

Another strange thing I noticed is that my project seems to be building into the wrong JAR file name (though if I do the above step of closing and reopening the project it still works). I have two projects with different names, and even after having closed the other project and restarted NetBeans a lot of times, when I build the first project it uses the JAR file name for the second project that has been closed for a long time.

推荐答案

我通过删除 NetBeans 的缓存修复了一个非常相似的行为.删除文件夹User.netbeans6.9varcacheindex.

I fixed a very similar behaviour by deleting NetBeans's cache. Delete the folder User.netbeans6.9varcacheindex.

Windows 7 和 Netbeans 7.2:用户AppDataLocalNetBeansCache7.2index

Windows 7 and Netbeans 7.2: UserAppDataLocalNetBeansCache7.2index

这篇关于在 NetBeans 6.9 中找不到主类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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