views:

34

answers:

2

I have a Java project in Netbeans with several jar files listed in its library section of properties.

I found a bug in one of the jar files and I want to step into it while debugging.

Here's what I've done so far:

  1. I've found the source code for the jar file.
  2. I opened that source as a project in NetBeans (it comes as a NetBeans project)
  3. I deleted that jar file from the compile-time libraries section of my project.
  4. I added the new project in the compile-time libraries section of my project using "add project".
  5. Did a clean and build on the new project, and on my project.

It builds and runs the same as before but I still can't step into the new project's code. But when I try to step into a method in the new project Netbeans says "cannot open (missing source?)". I also tried to set a breakpoint in the new project's method but Netbeans says "Not able to submit breakpoint LineBreakpoint ObjectMakerFactory.java : 203, reason: No executable location available at line 203 in class ...."

+1  A: 

Make sure you set the break point in the correct file that is actually deployed (make sure it's in the correct project), if you have multiple projects open.

Additionally, make sure under windows/debugging/sources that your source root is also enabled. In some versions this gets enabled by default, in others you have to add the source root and enable it with the checkbox.

dvanaria
Those look correct. Where should source root point to, the directory where the package starts? For example if the package is jpp.nar.crat.maker, should the source root point to /src of which jpp is a subdirectory?
Greg
Yes that is correct, point source root to the package root. But also, right-click the project's node and the Projects window and choose Properties. In the Project Properties dialog box, select the Sources tab and then click the Includes/Excludes button. Try including the path (both full and/or to the package root) there.
dvanaria
It seems to already be including everything. At the top of that dialog it says "**" and lists all the folders as included. Any other things I can try?
Greg
Here is a similar question posted on StackOverflow that may offer some help:http://stackoverflow.com/questions/87411/specifying-source-for-debugging-using-netbeans
dvanaria
A: 

I cant say for netbeans, but for Eclipse and IntelliJ I've always had success downloading the src jar and adding it to the project. Then, in my code when I click into the method for a class in the jar the IDE brings me to the source. If that is happening, you can set breakpoints in the src and proceed as normal.

hvgotcodes