Friday, 2 September 2011

Android - using findbugs from outside of Eclipse

I've been using findbugs to help track-down issues in Java code.  A great tool, and very easy to use. However, the Eclipse-based plug-in keeps crashing for me with a NullPointerException on certain projects.

The work-around to this is to run the findbugs UI directly.

To use findbugs on Windows, get the latest findbugs distribution from http://findbugs.sourceforge.net/downloads.html, and then create a shortcut along the following lines (note the -X argument, as the JVM might require quite a bit of memory to avoid failing for big projects!):
\java.exe -Xmx1024m -jar C:\findbugs-1.3.9\lib\findbugs.jar -gui

On Mac, simply run something like this directly:
java -Xmx1024m -jar ~/findbugs-1.3.9/lib/findbugs.jar -gui &

It is really use to use - just select File -> New Project, add your class folders to the top pane, your source folders to the bottom pane, and let it run!






No comments: