2

Im using the following config the debug jar file that under my root project, when I click on debug the program start to run but doesnt stopes since I didn't set any break-point(as this is jar file :) ) , In node.js there is option to do it with --inspect-brk info which stops on the first statement but not sure How to do it on jar file

My questions are

  1. How can I stops in the first line of the program jar ?
  2. Does my config are OK?

enter image description here

Oterwise , how can you able to debug jar if you cannot set a break-point ...

EDIT:

I've tried with the suggestion of crazycoder and it's not working, any idea?

What I tried is to create under my root project decomplie folder and run the following command

 java -jar fernflower.jar zte.jar + decomplie/

I got erorr of course of not found

I've also tried with

java -cp java-decompiler.jar org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler zte.jar + decomplie/ 

Could not find or load main class org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler

How to I get this jar (fernflower.jar ) or the path to it ?

EDIT2

My project is like this

-myjavaproj

 --zte.jar
 --decomile
 ---zte.jar
 ---com.proj.cli
 ----appmain.java 
Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Jenny Hilton
  • 1,297
  • 7
  • 21
  • 40

2 Answers2

1

Your config is a little strange, but correct. The VM options you provide tell the JVM to wait with running the zte.jar until a debugger is attached.

So you won't automatically stop on the first line, you need to add break-points in IDEA and attach it manually to the JVM process. This is explained here How to remote debug JVM

Keep in mind you are doing one thing sort of wrong. You do not need to setup the debug options in the VM options. Just select the JAR you want to debug, place break-points and start in debug mode (that is the bug like icon in IDEA).

  • Comments are not for extended discussion; this conversation has been [moved to chat](http://chat.stackoverflow.com/rooms/153267/discussion-on-answer-by-gerben84-debug-jar-intellij-or-command-line). – Bhargav Rao Aug 30 '17 at 15:02
1

For your specific project that is one jar file (zte.jar) which contains deps.zip inside which in turn contains other .jar dependencies and no sources at all and also uses reflection and custom classloader in order to load and use the .jar files in deps.zip; for the debugger to work, you have to unpack all the jars from the deps.zip into some location, then make a new IntelliJ IDEA project and add all the jars (including the root zte.jar and all the jars unpacked from deps.zip) into the module dependencies.

Browse to CliExecutor inside the self.jar, in the project view, IntelliJ IDEA will decompile it, place the breakpoints, debug it.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • Currently I was able to debug the `.class` files but since it's de-complied files its very hard to track the flow, is there way in Intellij to debug the decomplied `.java` files?(after I run the command ` java -cp ...`) I got in the decomplied folder all the .java files ...Thanks! – Jenny Hilton Sep 03 '17 at 11:38