Debian Codegraph @

src/doc/FAQ.html

raw symbols SCIP
1 <html>
2 <head>
3 <title>FindBugs FAQ</title>
4 <link rel="stylesheet" type="text/css" href="findbugs.css">
5 @GOOGLE_ANALYTICS@
6 </head>
7
8 <body>
9
10 <table width="100%"><tr>
11
12 @HTML_SIDEBAR@
13
14 <td>
15 <h1>FindBugs FAQ</h1>
16
17 <p> This document contains answers to frequently asked questions about
18 <a href="index.html">FindBugs</a>.&nbsp; If you just want general
19 information about FindBugs, have a look at the
20 <a href="factSheet.html">fact sheet</a> and the
21 <a href="manual/index.html">manual</a>.
22
23 <h2>Contents</h2>
24 <ol>
25 <li> <a href="#q1">I'm getting java.lang.UnsupportedClassVersionError when I try to run FindBugs</a>
26 <li> <a href="#q2">When I click the "Find Bugs!" button, I get a NoSuchMethodError or VerifyError</a>
27 <li> <a href="#q3">FindBugs is running out of memory, or is taking a long time to finish</a>
28 <li> <a href="#q4">What is the "auxiliary classpath"? Why should I specify it?</a>
29 <li> <a href="#q5">The Eclipse plugin doesn't load</a>
30 <li> <a href="#q6">I'm getting a lot of false "OS" and "ODR" warnings</a>
31 <li> <a href="#q7">The Eclipse plugin loads, but doesn't work correctly</a>
32 <li> <a href="#q8">Where is the Maven plugin for FindBugs?</a>
33 <li> <a href="#q9">Where is the NetBeans plugin for FindBugs?</a>
34 </ol>
35
36 <h2><a name="q1">Q1: I'm getting java.lang.UnsupportedClassVersionError when I try to run FindBugs</a></h2>
37
38 <p> FindBugs requires JRE 1.7.0 or later to run.&nbsp; If you use an earlier version,
39 you will see an exception error message similar to the following:
40 <pre>
41 Exception in thread "main" java.lang.UnsupportedClassVersionError:
42 edu/umd/cs/findbugs/gui/FindBugsFrame (Unsupported major.minor version 51.0)
43 </pre>
44 The solution is to upgrade to JRE 1.7.0 or later.
45
46 <h2><a name="q2">Q2: When I click the "Find Bugs!" button, I get a NoSuchMethodError or VerifyError</a></h2>
47
48 <p> The symptom of this bug is that when you start the FindBugs analysis,
49 you see an exception similar to the following:
50 <pre>
51 java.lang.NoSuchMethodError: org.apache.bcel.Repository.setRepository(Lorg/apache/bcel/util/Repository;)V
52 at edu.umd.cs.findbugs.FindBugs.clearRepository(FindBugs.java:483)
53 ...
54 </pre>
55
56 or
57
58 <pre>
59 java.lang.VerifyError: Cannot inherit from final class
60 at java.lang.ClassLoader.defineClass0(Native Method)
61 at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
62 ...
63 </pre>
64
65 <p> The problem here is that the wrong version of the
66 <a href="http://jakarta.apache.org/bcel/">Apache BCEL</a>
67 library is being found.&nbsp; FindBugs requires its own
68 version of BCEL, which normally will be used automatically
69 when you invoke the <code>findbugs</code> or <code>findbugs.bat</code>
70 scripts used to launch FindBugs.&nbsp; If an old version of BCEL is installed
71 in a location, such as "lib/endorsed" in the JRE installation,
72 where it overrides classes on the application classpath,
73 FindBugs will not execute properly.&nbsp;
74 We know of several reasons this could happen
75
76 <ul>
77 <li> If you install the
78 <a href="http://java.sun.com/webservices/downloads/webservicespack.html">Java(TM) Web Services
79 Developer Pack 1.2</a>
80 in the <code>lib/endorsed</code> directory of your Java Runtime Environment (JRE).&nbsp;
81 The file <code>xsltc.jar</code> contains an old version of BCEL that is incompatible with
82 FindBugs.&nbsp;
83
84 <li> Another possibility is that you are using the IBM JDK.&nbsp;
85 Some versions include a version of BCEL which conflicts with the
86 one required by FindBugs.&nbsp; This problem is fixed in version 1.4.1 SP1,
87 so upgrading your JDK should allow FindBugs to run correctly.
88
89 <li> Some versions of the Apache Xalan XSLT processor include
90 an old version of BCEL in <code>xalan.jar</code>.
91
92 </ul>
93
94 <p> In all of these cases, you should be able to run FindBugs
95 by either removing the offending version of BCEL from your JRE,
96 or installing a clean JRE or JDK and using that to run FindBugs.
97
98 <p> Many thanks to Peter Meulmeester, Michael Levi, and Thomas Klaeger
99 for providing information on this problem.
100
101 <h2><a name="q3">Q3: FindBugs is running out of memory, or is taking a long time to finish</a></h2>
102
103 <p> In general, FindBugs requires lots of memory and a relatively
104 fast CPU. For large applications, 1024M or more of heap space may be
105 required. By default, FindBugs allocates 768M of heap space.
106 You can increase this using the <code>-maxHeap <i>n</i></code> option,
107 where <i>n</i> is the number of megabytes of heap space to allocate.
108
109
110 <h2><a name="q4">Q4: What is the "auxiliary classpath"? Why should I specify it?</a></h2>
111
112 <p> Many important facts about a Java class require information about
113 the classes that it references.&nbsp; For example:
114 <ul>
115 <li> What other classes and interfaces the class inherits from
116 <li> What exceptions can be thrown by methods in external classes
117 and interfaces
118 </ul>
119
120 <p> The "auxiliary classpath" is a list of Jar files, directories, and
121 class files containing classes that are <em>used</em> by the code you
122 want FindBugs to analyze, but should not themselves be analyzed
123 by FindBugs.
124
125 <p> If FindBugs doesn't have complete information about referenced classes,
126 it will not be able to produce results that are as accurate as possible.&nbsp;
127 For example, having a complete repository of referenced classes allows
128 FindBugs to prune control flow information so it can concentrate on
129 paths through methods that are most likely to be feasible at runtime.&nbsp;
130 Also, some bug detectors (such as the suspicious reference comparison detector)
131 rely on being able to perform type inference, which requires complete
132 type hierarchy information.
133
134 <p> For these reasons, we strongly recommend that you completely specify
135 the auxiliary classpath when you run FindBugs.&nbsp; You can do this
136 by using the <code>-auxclasspath</code> command line option, or the
137 "Classpath entries" list in the GUI project editor dialog.
138
139 <p> If FindBugs cannot find a class referenced by your application, it
140 will print out a message when the analysis completes, specifying the
141 classes that were missing.&nbsp; You should modify the auxiliary classpath
142 to specify how to find the missing classes, and then run FindBugs again.
143
144 <h2><a name="q5">Q5: The Eclipse plugin doesn't load</a></h2>
145
146 <p> The symptom of this problem is that Eclipse fails to load
147 the FindBugs UI plugin with the message:
148 <blockquote>
149 Plug-in "edu.umd.cs.findbugs.plugin.eclipse" was disabled due to missing or disabled
150 prerequisite plug-in "org.eclipse.ui.ide"
151 </blockquote>
152
153 <p> The reason for this problem is that the Eclipse
154 plugin distributed with FindBugs
155 does not work with older 3.x versions of Eclipse.
156 Please use Eclipse version 3.6 (June 2010) or newer.
157
158 <h2><a name="q6">Q6: I'm getting a lot of false "OS" and "ODR" warnings</a></h2>
159
160 <p> By default, FindBugs assumes that any method invocation can
161 throw an unchecked runtime exception.&nbsp; As a result,
162 it may assume that an unchecked exception thrown out of the
163 method could bypass a call to a <code>close()</code> method
164 for a stream or database resource.
165
166 <p> You can use the <code>-workHard</code> command line argument
167 or the <code>findbugs.workHard</code> boolean analysis property
168 to make FindBugs work harder to prune unlikely exception
169 edges.&nbsp; This generally reduces the number of
170 false warnings, at the expense of slowing down the
171 analysis.
172
173 <h2><a name="q7">Q7: The Eclipse plugin loads, but doesn't work correctly</a></h2>
174
175 <p> Make sure the Java code you trying to analyze is built properly and has no
176 classpath or compile errors.
177
178 <p> Make sure the project and workspace FindBugs settings are valid - in doubt, revert them to defaults.
179
180 <p> Make sure the Error log view does not show errors.
181
182 <h2><a name="q8">Q8: Where is the Maven plugin for FindBugs?</a></h2>
183
184 <p>
185 The <a href="http://maven.apache.org/">Maven</a> Plugin for FindBugs
186 may be found <a href="http://mojo.codehaus.org/findbugs-maven-plugin/">here</a>.&nbsp;
187 Please note that the Maven plugin is not maintained by the FindBugs developers,
188 so we can't answer questions about it.
189 </p>
190
191 <h2><a name="q9">Q9: Where is the NetBeans plugin for FindBugs?</a></h2>
192
193 <p>We recommend <a href="http://kenai.com/projects/sqe/pages/Home">SQE: Software Quality Environment</a>
194 which bundles FindBugs, PMD and CheckStyle. Use the following
195 update site:
196 <a href="http://deadlock.netbeans.org/hudson/job/sqe/lastStableBuild/artifact/build/full-sqe-updatecenter/updates.xml
197 ">http://deadlock.netbeans.org/hudson/job/sqe/lastStableBuild/artifact/build/full-sqe-updatecenter/updates.xml</a>
198 <p>Pease note that the SQE plugin is not maintained by the FindBugs developers,
199 so we can't answer questions about it.
200 </p>
201
202 @HTML_FOOTER@
203
204 </td>
205
206 </table>
207
208 </body>
209
210 </html>