NetBeans has compile on save!

Guest Author

Today I downloaded the newest daily build of NetBeans 6.5. To my (pleasant) surprise, the "build project" menu item was grayed out. Yes, that means that NetBeans now compiles your files once you hit the save button. This also means that "Run" action is now mostly instantaneous because all files have already been built while as you worked on them.

To verify that "compile on save" works properly you can open your build directory in the "Files" tab and then right click on the file to see the file size (or open a file manager and watch the file size in the file manager). Make some changes to your sources and then once you save the file check whether the appropriate file size has changed in the build/classes directory. You should see that the file size of the class you edited has change on save because the .class file has been updated.

I was looking for an option to disable "compile on save" and found it in project properties in the "Compile" section. So if you don't like automatic compilation, you can turn it off, although it is enabled by default when you create a new project.

Join the discussion

Comments ( 16 )
  • Alexis MP Sunday, July 27, 2008

    Nice! How is the user experience when something doesn't compile?

  • cvasilak Sunday, July 27, 2008

    awesome! :)

    So now I can't add autoreloadable=true to my web.xml and then save and voila, servlet reload upon save!

    Keep up the good work netbeans engineers!


  • Peter Sunday, July 27, 2008

    This is great!

    Does it mean that it is equivalent to the

    incremental compiler of Eclipse??

    Regards, Peter.


  • Roman Sunday, July 27, 2008

    NetBeans had incremental compilation before (errors are highlighted as you type). What was added is that classfiles are replaced as you save the java classes, which allows much faster builds/deployment. So yes, I believe this is what Eclipse does.

  • Peter Sunday, July 27, 2008

    Hi Roman,

    yes you are right it is the same thing.

    Please see here:



  • Rohan Ranade Sunday, July 27, 2008

    Nice. However, I notice the Task Scanner run by default in the nightly builds and it takes eons to finish it's job. Couldn't even find an option to turn it off by default. Mighty pesky thing as compared to 6.1.

  • Karl Pietrzak Monday, July 28, 2008

    Oh my gosh, finally! =) I hope is works on files other than .java!

    I can't wait until 6.5 becomes stable.

  • Jan Becicka Thursday, July 31, 2008

    > I hope is works on files other than .java!

    Karl, which files do you have in mind?

  • Lukas Monday, August 4, 2008
  • 害虫駆除 Tuesday, August 26, 2008


  • peter yang Wednesday, August 27, 2008

    One easy way to push Sun hardware sales:

    Prepare simple and very practical Solaris manual and CDs.

    Keep information simple. Sure lots of Linux users will buy Sun box.

    Remember, manual MUST be simple and useful. If i know linux very well, i will not bother to read tons of document to use Solaris. Because most of work does not need.

  • sun Saturday, October 11, 2008

    Not trying to attract lin-ux users(or ms-ux users). :) It just isn't simple, wasn't simple, will never be simple. Pick up an old Solaris 8 or 9 software box, and you'll realize it's heavy, complex stuff. Always has been, always is, always will be. Not kids stuff, you know. No need to push Sun hardware sales, it selss itself. As for Beans...Could just call it SunTM BeansTM. Keep the brand simple, stupid. :)

  • aoc power leveling Wednesday, October 15, 2008

    The Star


    Twinkle, twinkle, little star!

    How I wonder what you are,

    Up above the world so high,

    Like a diamond in the sky.


    When the blazing sun is gone,

    When he nothing shines upon,

    Then you show your little light,

    Twinkle, twinkle all the night.


    The dark blue sky you keep

    And often thro' my curtains peep,

    For you never shut your eye

    Till the sun is in the sky.


    'Tis your bright and tiny spark

    Lights the traveler in the dark;

    Though I know not what you are

    Twinkle, twinkle, little star!

  • runescape powerleveling Wednesday, October 15, 2008

    At The Seaside


    When I was down beside the sea

    A wooden spade they gave to me

    To dig the sandy shore.


    The holes were empty like a cup

    In every hole the sea camp up,

    Till it could come no more.

  • Kovica Wednesday, October 29, 2008

    This feature should be called "Compile on save and run" according to http://wiki.netbeans.org/FaqCompileOnSave#section-FaqCompileOnSave-HowItWorks

  • alpha Tuesday, April 28, 2009
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.