I've selected a whole bunch of projects in NetBeans IDE below, each of which are, on disk, represented by a folder. Some are Maven-based, some Ant based, some Java EE, some Java SE, including a modular NetBeans Platform application. When I right-click and choose "Detect Dead Code", the Dead Code Detector will pop up and show the paths to the folder represented by each selected project. If within those folders any Java class files (i.e., compiled Java source files) are found, they will be analyzed for dead code. In other words, build the project, or compile individual packages or files, otherwise you'll not get any dead code detection results.
Here you see the full paths to the selected projects automatically displayed since I had those projects selected when invoking the "Detect Dead Code" action above:
And here you see the results, after clicking the "Detect dead code" button above and then enlarging the dialog a bit, i.e., possible dead code is identified. Not definitely dead code, but possibly dead code, based on the analysis done by the detector, and impacted by any filters you define. The next step is for me to show the info above as hyperlinks in the Output window.
Alternatively, go to the Source menu and near the end you'll see "Dead Code Detector", so that you can access it and use it even when you don't have any projects open in the IDE. Or press Ctrl-D which will pop up the detector too.
Go here to get the latest version of the plugin, i.e., version 1.2, which has all the support described in this blog entry:
Install it into NetBeans IDE 7.3.1 or above (the screenshots above come from NetBeans IDE 7.4 Beta).
Much more info on how the tool works and how it will improve your life: