Java Static Code analysis tool--findbugs plug-in installation and use

Source: Internet
Author: User

1 What is findbugsfindbugs is a static analysis tool that examines a class or JAR file and compares bytecode to a set of defect patterns to identify possible problems. With the static analysis tool, you can analyze the software without actually running the program. Rather than determining the intent of a program by parsing the form or structure of a class file, it is common to use the Visitor pattern to identify whether the code conforms to some fixed specifications. 2 How do I install findbugs? As a plug-in for Eclipse, you can integrate FindBugs into eclipse. The first is an online installation: Enter in the Eclipse plug-in installation addressHttp://findbugs.cs.umd.edu/eclipseAnd all the way "next" can be installed successfully. The second way is to download the FindBugs plugin, put it into the Plusin folder under Eclipse, and then restart Eclipse. 3 How to use findbugs after installing the FindBugs plugin. Right click on the item you want to check select "Find Bugs", "Find Bugs" to check. To see what Bugs findbugs checked out, you can open the Bug Explorer panel by choosing Windows menu->show View->bug Explorer. If you want to see detailed information about a bug, you can choose the Windows menu->open perspective, and then select FindBugs to open the Properties panel for FindBugs. In this panel you can see the most detailed bugs information. 4 FindBugs all bug types that can be found
FindBugs websitehttp://findbugs.sourceforge.net/bugDescriptions.htmlProvides a complete list of types. To install the FindBugs plugin:
  1. In Eclipse, click to Help, software Update , Find and Install ...
  2. Choose the Search for new features to install option, and click Next.
  3. Click New Remote Site.
  4. Enter the following:
    • Name: FindBugs Update site
    • URL: One of the following (Note:no final slash on the URL)
      • Http://findbugs.cs.umd.edu/eclipse for official releases
      • http://findbugs.cs.umd.edu/eclipse-candidate for candidate releases and official releases
      • http://findbugs.cs.umd.edu/eclipse-daily for all releases, including developmental ones
    and click OK.
  5. "FindBugs Update Site" should appear under Sites to include in search.
    Click the checkbox next to it to select it, and click Finish.
  6. You should see FindBugs Feature under Select features to install.
    (You could have to click on one or both triangles to make it visible in the tree.)
    Select the checkbox next to it and click Next.
  7. Select the I accept option to accept the license and click Next.
  8. Make sure the location is correct where you ' re installing it. The default (your workspace) should be fine. Click Finish.
  9. The plugin is not digitally signed. Go ahead and install it anyway.
  10. Click Yes to make Eclipse restart itself.
What does it do? FindBugs is an open source Eclipse Code Checker, which helps us to discover the bug,bad smell and potential pitfalls that exist in program code in a simple and efficient manner. For various problems, it also provides a simple modification of the comments for us to reconstruct the reference, by using it, can reduce the workload of our code review to some extent, and will improve the efficiency of review. Through FindBugs to find bugs, and then by our own refactoring code, we can cultivate our coding awareness and level, the formation of good habits to improve the development of coding ability. Where to download? :http://downloads.sourceforge.net/project/findbugs/findbugs%20eclipse%20plugin/1.3.9/ Edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821.zip?use_mirror=ncuHow do I install it? 1, unzip the downloaded compressed package,

Copy to eclipse in the plugin directory, 2, restart Eclipse3, open eclipse->window->preferences, search keyword findbugs, if you can find the configuration item, then the installation is successful,

How to use it? FindBugs simple and easy to use, according to the operation, 1, in the Eclipse package Explorer, right-click the target project--build project

2, select the specified package or class for Findbug

At this point findbugs will traverse the specified package or class, parse it, find the code bug, and then focus on the Bugs Explorer in Find bugs, and we'll add the bugs Explorer below. 3, adding FindBugs Explorer
(lower left corner of Eclipse)








3, after Bugs Explorer is added, we can view the bugs we just found,



The bugs identified are 3 colors, the black bug mark is classified, and the red bug indicates that the code must be modified after a serious bug is found, and the orange bug indicates a potential warning bug to try to modify. (appendix is a variety of bug interpretation and modification of the scheme, please refer to the schedule for revision) Double-click the bug item to automatically open the relevant code file and connect to the code snippet in the edit window on the right. Clicking on the little bug icon next to the line number will provide a detailed description of the bug, as well as suggestions for changes, in the output area below eclipse. We can make changes based on this information. Reference Suorceforge Address:http://findbugs.sourceforge.net/Official Documentation:http://findbugs.sourceforge.net/manualhttp://hi.baidu.com/seejava/blog/item/bbbd02382c7ea5f5b311c742.htmlReprinted from:http://tidus2005.iteye.com/blog/462212Sometimes MyEclipse8.5 can not update the plugin online, that is, obviously you add plug-ins, but can not apply changes (do not know why, who knows can tell me). Only use the offline installation, download the plug-in package, and then install it. And MyEclipse after the 7.0 version of the directory structure has changed, and is a big change, you can no longer find the Eclipse this folder, and the previous installation of the plug-in is in this folder to tamper with. On the internet to find a lot of articles, there are various statements, so that, do not work, and finally found a few useful, know the two offline plug-in installation methods. In general, the download back of the plugin after extracting only the two directory structure Eclipse directory, the following two folders: Features, plugins. Plug-in name directory (such as edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821), below the structure of the first structure of the plug-in should be the old version of the Eclipse offline installation directory structure, the latter should be relatively new structure, Of course, these are my guesses. Here is how to install, that is in the MyEclipse8.5 has a plug-in configuration file, this is necessary, location in: MyEclipse Installation root directory/configuration/ Org.eclipse.equinox.simpleconfigurator/bundles.info
All plug-ins must be configured in this file can be used, the format of this file is the package name, version number, file path, 4,false to install plug-ins The most necessary step is to add the plugin information tiger here OK. Installation steps: First, copy files if the directory structure, the contents of features, plugins, respectively, copy to the MyEclipse installation root/common/features and MyEclipse installation root directory/common/ The plugins directory. If this is the second directory structure, copy the extracted entire directory to the MyEclipse installation root directory/common/plugins directory. Second, configure the Bundles.info file if it is the first directory structure, append the following information at the end of Bundles.info: jp.gr.java_conf.ussiy.app.propedit,5.3.3,file:/d:/ MyEclipse 8.5/common/plugins/jp.gr.java_conf.ussiy.app.propedit_5.3.3.jar/,4,false If it is the second directory structure, Append a message similar to the following at the end of Bundles.info: Edu.umd.cs.findbugs.plugin.eclipse,1.3.9.20090821,file:/d:/myeclipse 8.5/Common/plugins /edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821/,4,false different is the first directory structure to be specified to the specific jar file, and the second directory structure only need to be assigned to the directory.  Third, restart the myeclipse. RELATED links:findbugs plug-in installation and use

Java Static Code analysis tool--findbugs plug-in installation and use

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.