Skip to main content

Limiting auto-compilation within Netbeans 6.0.1

Posted by kgrucci on March 3, 2008 at 10:08 AM PST

Earlier today, I was working with a java source file in Netbeans 6.0.1. The file is part of a very large project which I had opened in the IDE. Everything had been working fine until I decided that I needed to make a copy of the file I was editing (to try something out). I chose "Save as" from the File menu within Netbeans and saved the file to a new name in a different package (within the same project). At this point, Netbeans decided to recompile the entire project. This process bogged down the entire application to the point where even simple actions (such as selecting a menu item) took 5+ seconds.

After searching the Netbeans options as well as the internet for a way to turn off auto compilation within the IDE (with no success), I did stumble upon a way to include/exclude certain sources from being auto-compiled. To do this, right-click the project you want to affect (in the projects tab), and select "properties". Then click the "includes/excludes" button in the bottom right corner of the dialog. The dialog that comes up will allow you to explicitly include and/or exclude sources within your project from being auto-compiled. The next time I added a file to the project, the auto-compile took only seconds since I had only included the sources that I am responsible for. See this Netbeans wiki entry for more info.

Related Topics >>


In this particular case I think Netbeans is right to not make this configurable. It's already swimming in 1000 different configuration options and this is one of the few features that doesn't really need to be configurable. I would argue that for the vast majority of users this one-time cost is very small. Netbeans rarely spends more than 5 seconds compiling new projects when I open them and if you're one of those rare cases with huge projects so maybe they should alter the thread priority to be lower but I don't think they should make it configurable.

It's not like you don't want Netbeans to compile your projects (because you need this for the refactoring feature), you just don't want it to get in your way. Those are two different things. Just my 2 cents.

That is the problem. For large projects, the IDE does get in your way unless you use the includes/excludes mechanism above.