简体   繁体   English

NetBeans IDE 未运行项目或文件

[英]NetBeans IDE not running project or file

I have worked with NetBeans in the past and I wanted to work with it again, it was a long process of installing but I finally got it, and now that I am here it will not let me run my projects.我过去曾使用过 NetBeans,我想再次使用它,这是一个漫长的安装过程,但我终于得到了它,现在我在这里它不会让我运行我的项目。 For one: It does not create a project with ant(at all) For two: whenever I create a class it does not automatically close the name the class screen For Three: When I right-click my class the run-file option is greyed out For four: When I click run project the screen is stuck on "Initializing view, please wait..."其一:它根本不使用 ant 创建项目 其二:每当我创建 class 时,它不会自动关闭名称 class 屏幕 其三:当我右键单击我的 class 时,运行文件选项呈灰色四:当我点击运行项目时,屏幕停留在“正在初始化视图,请稍候...”

I really need to get this to work and I just can't seem to figure out what I'm doing wrong or if I am even doing something wrong.我真的需要让它工作,但我似乎无法弄清楚我做错了什么,或者我什至做错了什么。

Some suggestions to try:一些尝试的建议:

  1. Run a clean and build运行清理并构建
  2. Right click the project --> properties --> ensure the correct main class is set右键单击项目--> 属性--> 确保设置了正确的主类
  3. Upgrade and/or restart NetBeans升级和/或重新启动 NetBeans

Good luck!祝你好运!

Regarding the 4th problem:关于第四个问题:

You need to set the main class in your project.您需要在项目中设置主类。

  • Right Click on the project folder, then click properties .右键单击项目文件夹,然后单击properties
  • Get to the tab run .进入选项卡run
  • Now type in the direction of your Main class you want to run: package + name of the class现在输入您要运行的主类的方向:包+类的名称

example: package name: com.mycompany.myproject class name: MyClass.java -> directory of Main Class: com.mycompany.myproject.MyClass示例:包名:com.mycompany.myproject 类名:MyClass.java -> 主类目录: com.mycompany.myproject.MyClass

  • click ok and try again单击确定并重试

Worked for me为我工作

Had the same issue, couldn't get it to work for the life of me, installed the latest version and everything went smoothly.有同样的问题,无法让它在我的生活中工作,安装了最新版本,一切顺利。 I suggest not wasting time troubleshooting as I did, but instead updating to the latest version first.我建议不要像我一样浪费时间进行故障排除,而是先更新到最新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM