Develop In Java
  • Home
  • News
  • Tips and Tricks
  • Articles
    • Books>
      • Alfresco Enterprise Content Management Implementation
        • Beginning Java EE 6 Platform with GlassFish 3
          • EJB 3.1 Cookbook
            • GlassFish Security
              • GWT Java Ajax Programming
                • Java EE 5 Development using GlassFish Application Server
                  • JBoss RichFaces
                    • Seam 2.x Web Development
                    • Desktop Java>
                      • An Overview of The New Features in J2SE 5.0
                        • Using FindBugs with NetBeans 5.5
                        • Enterprise Java>
                          • Basic Java CRUD Operations With MongoDB
                            • Continuous Integration with Hudson on Glassfish
                              • Creating a Simple Spring MVC Web App With NetBeans 5.0
                                • Creating a Simple Spring MVC Web App With NetBeans 5.0 Part 2
                                  • Creating a Weld Project using Maven and NetBeans
                                    • Deploying a Java EE Web Application to OpenShift Express
                                      • Developing your first Web Service with Java EE 5 and NetBeans
                                        • Introduction to JSF 2 Using NetBeans and GlassFish
                                          • Securing a Web Application on Glassfish using JAAS
                                            • Securing a Web Application on Glassfish using JAAS Part 2
                                          • Links
                                          • Forums
                                          • Search
                                          • Contact Us

                                          Using FindBugs with NetBeans 5.5

                                          David Salter, 3rd May 2007
                                          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.
                                          Picture
                                          Expand the "IDE Configuration | System | Autoupdate Types" node as shown below and then right click on "Autoupdate Types" and select "New | General Update Center".
                                          Picture
                                          In the New General Update Center dialog, enter the name as "FindBugs" and press "Finish".
                                          Picture
                                          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:
                                          https://sqe.dev.java.net/updatecenters/nbheaven-updatecenter.xml

                                          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.
                                          Picture
                                          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.
                                          Picture
                                          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.
                                          Picture
                                          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.
                                          Picture

                                          Conclusion

                                          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.
                                          You can discuss this article here.

                                          Copyright (C) DevelopInJava.com 2006-2012