Findbugs integration in NetBeans

FindBugs is a “must-use” tool for any serious Java programmer to detect real and potential critical bugs in our code.

There are two different ways to use FindBugs:

  • while we are coding (inside the IDE) and
  • as a step in the project quality checks phase (usually via a maven plugin).

NetBeans support both usages.First of all, we need to enable the plugin “FindBugs Integration” in “Tools –> Plugins”

FindBugs Integration plugin

FindBugs Integration plugin

FindBugs analysis configuration is available in Tools –> Options –> Editor –> Hints.

Select FindBugs in the “Language” drop-down menu.

FindBugs Options Window

FindBugs Options Window

In this window, there is a “Run FindBugs in Editor” check-box. If enabled, FindBugs will be executed on the .java file we are working on (just after the save).

Note: FindBugs works on .class files and not on source (.java files).

FindBugs can be executed on the complete project using the Source –> Inspect function:

Inspection Dialog

Inspection Dialog

The results of the FindBugs analysis on the complete project is reported in the “Inspector” window:

Inspector Window

Inspector Window


  • Editor level analysis is done on a single file and with minimal FindBugs effort (to avoid to slow down the editor)
  • Inspection analysis is done on all project class files with deeper FindBugs effort. In this case, it is acceptable to have a slower but more accurate analysis.

The two different analysis can bring to different violations detected.

2 thoughts on “Findbugs integration in NetBeans

  1. Reblogged this on Ade's Tech Notes and commented:
    A quick and well-written introduction to the FindBugs plugin in Netbeans. This is really helpful when refactoring your code.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s