2

Is it possible to decompile a Java application and debug it using the decompiled code?

I'm interested more in the ability to debug using the decompiled code, rather than decompilation itself (it's trivial).

CDspace
  • 2,639
  • 18
  • 30
  • 36
Steve Kero
  • 703
  • 2
  • 7
  • 14

4 Answers4

2

Yes there are java decompilers available on internet, both paid and unpaid. I am currently using one called 'DJ java decompiler', which provides a free trial version, just google it.

You can hope that the jar you are trying to decompile and make some sense out of the class files, is not obfuscated.

Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136
2

yes it is possible click to download java decompiler for free

other links link1 link2

SpringLearner
  • 13,738
  • 20
  • 78
  • 116
  • 2
    I'm interested more in ability to debug using this code, rather than decompilation itself (it's trivial). – Steve Kero Oct 03 '13 at 09:19
2

It is indeed possible, as many others have already pointed out.

If you want to just decompile a JAR and debug the decompiled classes by running them directly (i.e. using them as sources), there are plenty of decompilers that will serve you well.

If you're planning to debug a JAR in use in your application, look out for proper source code line number alignment features when choosing your decompiler. Take a look for instance at this question. You can end up with decompiled code like this:

Line X /* Line Y */ int x = y
Line Y (anything can be here, it could even not exist)

With totally different values for X and Y. This means that Line X in your decompiled .java file corresponds to line Y of the compiled code. When debugging the jar, you'll have to put a breakpoint at line Y in the source file to stop there. That can be quite annoying to debug. There are decompilers that will align the decompiled code in the source file respecting line numbers.

Line X /* Line X */ int x = y

I have used JD-Eclipse Realign with success on Eclipse. Believe me, it does make a difference to debug decompiled code with source line alignment.

Gurwinder Singh
  • 38,557
  • 6
  • 51
  • 76
Xavi López
  • 27,550
  • 11
  • 97
  • 161
0

If the application decompiles nicely and hasn't been stripped of debug info, sure.

Kayaman
  • 72,141
  • 5
  • 83
  • 121