Documentation / Tutorials

Developing with NetBeans

Tips & Hints

--Anchor(tip1)--Module Development Turnaround Time: Better Than You Thought

So you're creating a desktop application in NetBeans IDE, basing it on the NetBeans Platform.

  • Don't shut down the application. Just leave it running.

  • Whenever you add something to a module, and you want to see it in action within the application... right-click the module and choose "Install/Reload in Target Platform". Since the module belongs to the module suite, and the module suite is your application, the module loads into the running application and you can see the result right away.

As a result, reloading a module takes only a few seconds. (If the TopComponent for which you made the change is already displayed in the running application, you just need to reopen it, to refresh it, but that's the only additional step I needed to take.)

Also if you run the app in the debugger, you can use Run > Apply Code Changes to use JPDA hot swapping. Only works for changes made in Java source code (that do not add/remove methods/fields/etc.), so limited but still useful in some cases.

--Anchor(tip2)--*[ NetBeans already support compile-on-save, in a way... Just press Ctrl-S and then F9. Now you've saved and compiled a file... It involves three keys, but so do other shortcuts, it isn't unique in any way. If you want to use two shortcuts instead, remap "Save" to something else (for example, F10 is free, so map "Save" to F10, and then all you need is to press F10 and then F9 and then you've saved and compiled a file). The same approach can be taken for projects too...

Or, the other way round -- you'd probably want the compile to be before the save, so F9, then Ctrl-S, or F9 F10, if you remap "Save" to F10, as suggested above.

Add picture from clipboard (Maximum size: 40 MB)