Similar to commands for compiling and running, debugging commands rely on
various information, such as the location of your
sources, the location of the compiled classes and other items on the classpath,
and name of the project's main class.
In , the IDE does not "know"
about any of these things. When you run a command in the IDE (such as Build),
the IDE simply calls a target in your build script and lets the script handle
the command. Therefore, for debugging to work, you also have to have a build script
target for debugging. The IDE provides some custom Ant tasks to work with the debugger
and also can generate a basic debug target, which attempts to fill in important
details based on other targets in your script.
To set up debugging in a free-form project, you need to do the following:
Make sure that your classes are compiled with debugging information included. For
example, you might accomplish this in the compile
target of your build script by including the argument debug="true" in the <javac> task.
Set the output of the free-form project.
If the output of a free-form project is on the classpath of another project,
map the free-form project's source packages to their outputs. This ensures that you can use the
debugger to step into the project's sources when you start a debugging session in a
project that has a dependency on the free-form project.
To declare the output files, right-click the free-form project
node and choose Properties. Then click the Output category in the Properties window
and specify the output file for each source folder.
Confirm that the target JDK is set in your Ant script and the source
level is specified in the Project Properties dialog box. When you step into JDK
classes, the IDE searches the platforms registered in the Java Platform Manager
for a Java platform with a matching source level. If no matching Java platform
is found, the IDE opens the source code for the IDE's default platform.
Create a target in your build script for debugging and map that target to
the IDE's Debug Project command. The IDE can assist you by generating a basic target
and mapping, but you might need to modify the target. See
Creating A Debug Target for a Free-Form
Java Project for step-by-step instructions.
For a full guide to configuring free-form projects, see the following document.