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

查看:160
本文介绍了在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文件名. /p>

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\.netbeans\6.9\var\cache\index\.

I fixed a very similar behaviour by deleting NetBeans's cache. Delete the folder User\.netbeans\6.9\var\cache\index\.

Windows 7和Netbeans 7.2: User \ AppData \ Local \ NetBeans \ Cache \ 7.2 \ index

Windows 7 and Netbeans 7.2: User\AppData\Local\NetBeans\Cache\7.2\index

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

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