从Netbeans构建和运行java应用程序 [英] Building and running a java application from Netbeans
问题描述
我最近开始使用来自Eclipse的NetBeans。
I've recently started using NetBeans, coming from Eclipse.
我有一个简单的SnakeYaml实现(一个用于java的yaml解析器)我试图测试。它包含在一个主要的方法中。
I have a simple implementation of SnakeYaml (a yaml parser for java) I am trying to test. It is contained in a main method.
当我尝试运行它(F6)像我在Eclipse中,我得到一个成功的构建,但没有输出。相反,要运行我的程序,我需要先构建(F11),然后运行(F6)。
When I try to run it (F6) like I would in Eclipse, I get a successful build but no output. Instead, to run my program, I need to first build (F11), then run (F6). Is there a way for my project to be automatically built when I try to run it.
注意: Netbeans实际上告诉我我不要
Note: Netbeans actually tells me I don't have to build to run from inside the IDE, but it seems to be lying.
推荐答案
@MaxMackie不是回答
@MaxMackie not an answer
1)project - > properties - > compiling - > Compile on Save - mark checked
1) project -> properties -> compiling -> Compile on Save - mark checked
- > Run - > select main.class(因为你的项目可以包含吨的Java类,包含main方法)
2) project -> properties -> Run -> select main.class (because your project can contains tons Java Classes that contains main method too)
最后一个属性是将当前项目设置为主项目我从来没有需要检查或设置),并检查工具 - >选项 - >键映射
last property is to set current project as main project (i never ever to needed to check or set that) and check tools -> options -> keymap
这篇关于从Netbeans构建和运行java应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!