Why can't I step into my source code when using the Ant debug target that I generated in the IDE for my free-form project?

If you are unable to step from line to line in your code, but only from breakpoint to breakpoint, the IDE has not been able to find your sources. This is because you have not specified your sources correctly.

  • Java classes (e.g., servlets): Choose Window > Debugging > Sources. The Sources window displays all the Java source folders that are available for debugging. If you want to debug a source folder that is not available in the Sources window, specify it in the Project Properties dialog box:
    1. Right-click the project node, choose Properties, click Java Sources.
    2. Add the source folders to be debugged to the Source Package Folders table or to the Test Package Folders table.

Note that the target you use for compiling Java classes must specify debug="true" when calling the javac task. If a servlet is compiled without debug info, the debugger will not stop on its breakpoints.

  • JSP pages: Make sure that you have defined a context path for the project:
    1. Right-click the project node, choose Properties, click Web Sources.
    2. Type the context path. For example, type /MyProject in the Context Path field.

Note that if you have set your breakpoints before specifying the context path, you must remove and reset the breakpoints after specifying the context path. In other words, the context path must be set first.

Also make sure that the sources are correctly specified in the debug.properties file and in the debug-nb target. Note that if your nbproject folder is not housed within the folder that houses your sources folder, the properties containing the path to your Java and web sources should be relative to the value of the project.dir property, such as the following:

  • src.folders=${project.dir}/src
  • web.docbase.dir=${project.dir}/web

  Applies to: NetBeans 4.1, 5.x, 6.x
  Platforms: All
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo