Using FindBugs with NetBeans 5.5
FindBugs is a static analysis tool that helps developers find bugs within their source code. To make using FindBugs easier within NetBeans, a NetBeans Plug-in is available.
Installing the Plug-in
|The easiest way to install the FindBugs plugin into NetBeans is to add the plug-in update center into NetBeans and then update the software. To install the update center, open up NetBeans and select “Tools||Options” (on Macs, select “NetBeans||Preferences”. On the following screen, press the “Advanced Options” button. The screen shown below should be displayed.|
|Expand the “IDE Configuration||System||Autoupdate Types” node as shown below and then right click on “Autoupdate Types” and select “New||General Update Center”.|
In the New General Update Center dialog, enter the name as “FindBugs” and press “Finish”.
Now that we’ve added an update center for the FindBugs plug-in, we need to define where to download updates from. Select the newly added “FindBugs” node in the Advanced Options dialog. Enter the Server URL as:
and close the preferences window.
|The FindBugs plug-in update center is now fully defined within NetBeans. Select the “Tools||Update Center” menu option and ensure that the FindBugs update center is selected.|
Select the “Next” button and NetBeans will connect to the update center. Select all the FindBugs modules to install as shown in the following screen shot.
Read and accept all the licence conditions and select all the modules that the update center has downloaded.
NetBeans will now install the plug-in and a little bug icon will be displayed in the toolbar showing that the installation has completed successfully.
To run FindBugs on your project, press the bug icon in the toolbar. FindBugs will be invoked and will check all your source files in the project. A new panel will be displayed within NetBeans showing the results of the FindBugs analysis of your code.
In this article, I’ve shown how to install the FindBugs plug-in into NetBeans 5.5 and how to run the plugin to find bugs within your source code. Be sure to check out the FindBugs and Plug-in web sites for further details.