开发者

Java / NetBeans - How to Step into a jar file?

开发者 https://www.devze.com 2023-01-14 13:06 出处:网络
I have a Java project in Netbeans with several jar files listed in its library section of properties.

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 co开发者_如何学运维mpile-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 ...."


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消