In a , you must set up your own Ant target to run a project
in the debugger. However, you can use the IDE to generate a debug target for you.
When you do so, the IDE maps the debug target to the Debug Project command.
Alternatively, if you have your own debug target, you must map it to the
Debug Project command yourself.
To generate a debug target:
Choose Run > Debug Main Project (Ctrl-F5). If no target is mapped to
the Debug Project command,
you are prompted to let the IDE generate an IDE-specific debug target
in nbproject/ide-targets.xml.
Click Generate. The IDE does the following:
Generates a target named debug-nb. The target is generated
in the new nbproject/ide-targets.xml file, together with other
targets that support it, such as the debug-display-browser target.
These targets do the following:
Check whether Ant is running inside the IDE (if="netbeans.home").
Start the debugger with the nbjpdaconnect task.
Connect the debugger to the application to be debugged at the specified host
(jpda.host) and port number (jpda.address).
Open the IDE's web browser at the URL specified by the client.url property.
Generates and defines debug properties. The properties are defined in
the new nbproject/debug.properties file. The properties define the following:
The sources that are to be debugged.
The server to which the application to be debugged is to be deployed.
The port number and address to be used.
The client URL.
Maps the debug-nb target to the Debug Project command.
In the Files window, go to the nbproject/debug.properties file and edit
the debug properties, if necessary.
If you use the IDE to generate the debug target, as described in the previous section,
the target is automatically mapped to the Debug Project command. However, if your debug target
was not generated by the IDE, you must map it to the Debug Project command manually.
To map a debug target to the Debug Project command:
In the Projects window, right-click the project node and choose Properties.
Click Build and Run in the left panel of the Project Properties dialog
box.
Click Add, select your debug target, and type a label, such as "Debug Project".
If you want to map the debug action to a target in a separate Ant script,
open the project's project.xml file and add the following to <ide-actions>:
Right-click the project node in the Projects window,
choose Properties, click Java Sources in the Project Properties dialog box,
and make sure that all the source files you want to debug are listed in
the Source Package Folders list.
In the Services window, expand the Servers node, right-click the server instance and choose Start/Stop Server.
Click Start Server (Debug).
Use catalina jpda start to start the external Tomcat Server in debug mode.
Make sure that you have a debug target and that it is mapped to
the Debug Project command, as described in the previous sections.
Choose Run > Debug Main Project (Ctrl-F5).
For a full guide to configuring free-form projects, see: