Pavan Kumar
Pavan Kumar

Reputation: 211

How can we debug a file which is inside Jar file

I have a existing Application , in which some of the code is present inside JAr file . Please tell me how can we debug a file which is inside Jar file ??

I have used JD-GUI , opened that jar and saved all the source inside my harddisk and attaached this source to the class file from Eclipse . And When i tried to put breakpoints to that class file , the debugger doesn't stop there .

Please tell me how to deal with this situation ??

Upvotes: 2

Views: 4376

Answers (3)

ankur_rajput
ankur_rajput

Reputation: 145

IntelliJ idea (Community edition also) supports adding breakpoints to a decompiled source.

  1. Add your jar file as a library to your project.

IntelliJ idea CE Project Structure -> Add Java library

  1. Open the Java class (make sure that 'All Places' is selected)

  2. Add the breakpoint and debug like you do in a Java source code.

Upvotes: 0

Chintan Patel
Chintan Patel

Reputation: 739

You need source of that jar for this. May be you will get from following link what you want

http://javarevisited.blogspot.in/2012/12/how-to-attach-source-in-eclipse-Jar-JDK-debugging.html

Upvotes: 0

Shreyos Adikari
Shreyos Adikari

Reputation: 12744

You try this one:

First open the jar file using JD(Java Decompiler), then click on File -> Save JAR Sources and it will become a .zip file containing the java source files. Then you can add this source zip file in the debug configuration using add source. It will work then for sure.

I also faced the similar issue,sometime while debugging the jar file classes. But after the above procedure the issue got resolved.

Thanks

Upvotes: 2

Related Questions