?? running.html
字號:
<html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Chapter 4. Running FindBugs™</title><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="FindBugs™ Manual"><link rel="up" href="index.html" title="FindBugs™ Manual"><link rel="prev" href="building.html" title="Chapter 3. Building FindBugs™ from Source"><link rel="next" href="gui.html" title="Chapter 5. Using the FindBugs GUI"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Running <span class="application">FindBugs</span>™</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="building.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="gui.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="running"></a>Chapter 4. Running <span class="application">FindBugs</span>™</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="running.html#d0e473">1. Quick Start</a></span></dt><dt><span class="sect1"><a href="running.html#d0e511">2. Executing <span class="application">FindBugs</span></a></span></dt><dt><span class="sect1"><a href="running.html#commandLineOptions">3. Command-line Options</a></span></dt></dl></div><p><span class="application">FindBugs</span> has two user interfaces: a graphical user interface (GUI) and acommand line user interface. This chapter describes how to run each of these user interfaces.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="warning.png"></td><th align="left">Warning</th></tr><tr><td align="left" valign="top"><p> This chapter is in the process of being re-written. The rewrite is not complete yet. </p></td></tr></table></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e473"></a>1. Quick Start</h2></div></div></div><p> If you are running <span class="application">FindBugs</span> on a Windows system, double-click on the file <code class="filename"><em class="replaceable"><code>%FINDBUGS_HOME%</code></em>\lib\findbugs.jar</code> to start the <span class="application">FindBugs</span> GUI. </p><p> On a Unix, Linux, or Mac OS X system, run the <code class="filename"><em class="replaceable"><code>$FINDBUGS_HOME</code></em>/bin/findbugs</code> script, or run the command </p><pre class="screen"><span><strong class="command">java -jar <em class="replaceable"><code>$FINDBUGS_HOME</code></em>/lib/findbugs.jar</strong></span></pre><p> to run the <span class="application">FindBugs</span> GUI. </p><p> Refer to <a href="gui.html" title="Chapter 5. Using the FindBugs GUI">Chapter 5, <i>Using the <span class="application">FindBugs</span> GUI</i></a> for information on how to use the GUI. </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e511"></a>2. Executing <span class="application">FindBugs</span></h2></div></div></div><p> This section describes how to invoke the <span class="application">FindBugs</span> program. There are two ways to invoke <span class="application">FindBugs</span>: directly, or using a wrapper script. </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="directInvocation"></a>2.1. Direct invocation of <span class="application">FindBugs</span></h3></div></div></div><p> The preferred method of running <span class="application">FindBugs</span> is to directly execute <code class="filename"><em class="replaceable"><code>$FINDBUGS_HOME</code></em>/lib/findbugs.jar</code> using the <span><strong class="command">-jar</strong></span> command line switch of the JVM (<span><strong class="command">java</strong></span>) executable. (Versions of <span class="application">FindBugs</span> prior to 1.3.5 required a wrapper script to invoke <span class="application">FindBugs</span>.) </p><p> The general syntax of invoking <span class="application">FindBugs</span> directly is the following:</p><pre class="screen"> <span><strong class="command">java <em class="replaceable"><code>[JVM arguments]</code></em> -jar <em class="replaceable"><code>$FINDBUGS_HOME</code></em>/lib/findbugs.jar <em class="replaceable"><code>options...</code></em></strong></span></pre><p> </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="chooseUI"></a>2.1.1. Choosing the User Interface</h4></div></div></div><p> The first command line option chooses the <span class="application">FindBugs</span> user interface to execute. Possible values are: </p><div class="itemizedlist"><ul type="disc"><li><p> <span><strong class="command">-gui</strong></span>: runs the graphical user interface (GUI) </p></li><li><p> <span><strong class="command">-textui</strong></span>: runs the command line user interface </p></li><li><p> <span><strong class="command">-version</strong></span>: displays the <span class="application">FindBugs</span> version number </p></li><li><p> <span><strong class="command">-help</strong></span>: displays help information for the <span class="application">FindBugs</span> command line user interface </p></li><li><p> <span><strong class="command">-gui1</strong></span>: executes the original (obsolete) <span class="application">FindBugs</span> graphical user interface </p></li></ul></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="jvmArgs"></a>2.1.2. Java Virtual Machine (JVM) arguments</h4></div></div></div><p> Several Java Virtual Machine arguments are useful when invoking <span class="application">FindBugs</span>. </p><div class="variablelist"><dl><dt><span class="term"><span><strong class="command">-Xmx<em class="replaceable"><code>NN</code></em>m</strong></span></span></dt><dd><p> Set the maximum Java heap size to <em class="replaceable"><code>NN</code></em> megabytes. <span class="application">FindBugs</span> generally requires a large amount of memory. For a very large project, using 1500 megabytes is not unusual. </p></dd><dt><span class="term"><span><strong class="command">-D<em class="replaceable"><code>name</code></em>=<em class="replaceable"><code>value</code></em></strong></span></span></dt><dd><p> Set a Java system property. For example, you might use the argument <span><strong class="command">-Duser.language=ja</strong></span> to display GUI messages in Japanese. </p></dd></dl></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="wrapperScript"></a>2.2. Invocation of <span class="application">FindBugs</span> using a wrapper script</h3></div></div></div><p> Another way to run <span class="application">FindBugs</span> is to use a wrapper script. </p><p>On Unix-like systems, use the following command to invoke the wrapper script:</p><pre class="screen"><code class="prompt">$ </code><span><strong class="command"><em class="replaceable"><code>$FINDBUGS_HOME</code></em>/bin/findbugs <em class="replaceable"><code>options...</code></em></strong></span></pre><p></p><p>On Windows systems, the command to invoke the wrapper script is </p><pre class="screen"><code class="prompt">C:\My Directory></code><span><strong class="command"><em class="replaceable"><code>%FINDBUGS_HOME%</code></em>\bin\findbugs.bat <em class="replaceable"><code>options...</code></em></strong></span></pre><p></p><p>On both Unix-like and Windows systems, you can simply add the <code class="filename"><em class="replaceable"><code>$FINDBUGS_HOME</code></em>/bin</code>directory to your <code class="filename">PATH</code> environment variable and then invokeFindBugs using the <span><strong class="command">findbugs</strong></span> command.</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="wrapperOptions"></a>2.2.1. Wrapper script command line options</h4></div></div></div><p>The <span class="application">FindBugs</span> wrapper scripts support the following command-line options. Note that these command line options are <span class="emphasis"><em>not</em></span> handled by the <span class="application">FindBugs</span> program per se; rather, they are handled by the wrapper script. </p><div class="variablelist"><dl><dt><span class="term"><span><strong class="command">-jvmArgs <em class="replaceable"><code>args</code></em></strong></span></span></dt><dd><p> Specifies arguments to pass to the JVM. For example, you might want to set a JVM property:</p><pre class="screen"><code class="prompt">$ </code><span><strong class="command">findbugs -textui -jvmArgs "-Duser.language=ja" <em class="replaceable"><code>myApp.jar</code></em></strong></span></pre><p> </p></dd><dt><span class="term"><span><strong class="command">-javahome <em class="replaceable"><code>directory</code></em></strong></span></span></dt><dd><p> Specifies the directory containing the JRE (Java Runtime Environment) to use to execute <span class="application">FindBugs</span>. </p></dd><dt><span class="term"><span><strong class="command">-maxHeap <em class="replaceable"><code>size</code></em></strong></span></span></dt><dd><p> Specifies the maximum Java heap size in megabytes. The default is 256. More memory may be required to analyze very large programs or libraries. </p></dd><dt><span class="term"><span><strong class="command">-debug</strong></span></span></dt><dd><p> Prints a trace of detectors run and classes analyzed to standard output. Useful for troubleshooting unexpected analysis failures. </p></dd><dt><span class="term"><span><strong class="command">-property</strong></span> <em class="replaceable"><code>name=value</code></em></span></dt><dd><p> This option sets a system property. <span class="application">FindBugs</span> uses system properties to configure analysis options. See <a href="analysisprops.html" title="Chapter 9. Analysis Properties">Chapter 9, <i>Analysis Properties</i></a>. You can use this option multiple times in order to set multiple properties. Note: In most versions of Windows, the <em class="replaceable"><code>name=value</code></em> string must be in quotes.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -