是否有任何选项可以在项目中构建单个Java文件 [英] Is there any option to build a single java file in the project

查看:78
本文介绍了是否有任何选项可以在项目中构建单个Java文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在struts2中进行项目,然后进入休眠状态.我的项目有点长,我的问题是在java文件中做一些小的更改后,我必须清理并构建整个项目,并且运行该项目需要很长时间.是否可以为仅更改的文件创建java类,我使用netbeans编辑器作为编辑器.

I am doing my project in struts2 and hibernate. My project is little bit long and my problem is when done a small change in java file i have to clean and built the entire project and it is taking very long time to run the project. Is there any option to create the java class for the files that i have changed only, i am using netbeans editor as editor.

推荐答案

默认情况下,Netbeans将在保存模式下使用其编译模式,如

By default Netbeans is going to use its compile on save mode, as mentioned in this other answer. Everytime you modify and save a file, it automatically tries to compile it (as well as required dependencies if any).

虽然此模式处于活动状态,但是您没有对编译的每个文件控制,也几乎没有对项目编译的控制.您唯一的选择是Run-> Clean& Build会删除任何自动编译的类,再次编译所有内容,然后从您的项目中构建一个JAR.

While this mode is active, you have no per-file control on compilation and very little control over project compilation either. Your only option is Run -> Clean & Build which deletes any auto-compiled class, compiles everything again and builds a JAR out of your project.

这样,要控制单文件的编译,首先需要在项目属性的构建/编译"部分中取消选中保存时编译"选项(右键单击项目"选项卡中的项目,然后单击确定").在属性上).完成后,您将在运行"菜单中获得一个新选项:编译文件(默认情况下与F9关联).当然,这也意味着您现在需要在需要时通过运行"菜单手动启动构建.

As such, to control single-file compilation, you first need to uncheck the Compile on Save option in the Build/Compiling section of your project properties (right click on project in Projects tab, click on Properties). Once done, you get a new option in the Run menu: Compile File (associated to F9 by default). Of course, it also means you will now need to manually launch builds through the Run menu whenever it is necessary.

这篇关于是否有任何选项可以在项目中构建单个Java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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