• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to effectively debug jar from third party  RSS feed

 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
until now, I always rely on grepcode.com to see what's actually inside jars from third party (when having doubt about how to extend certain class inside third party jar). Is there any more efficient way to do this?
IDE is eclipse.
thanks
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the best way to find out how to use a third part library is to read the Javadoc. That does of course assume that the authors of the library wrote adequate documentation.

You can often download both the javadoc and the source code alongside the executable code, and eclipse (and other IDEs) can use this to display the javadoc in tooltips, and 'step-into' the third party code when in debug mode.

 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, I'm not good with human language, sometimes they're ambiguous, so I prefer code, less ambiguous, if you know what I mean. That's why I'm searching for efficient way to see the code. thanks
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then see if the source for the library can be downloaded (often called src.zip). Eclipse can use this to display the source for classes in the library just as if it was one of the classes in your project.
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nope, it's not available for download. I got this from some forum and the poster is not active anymore. Is there any tool that could decompile with ease? thanks
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Spades wrote:nope, it's not available for download. I got this from some forum and the poster is not active anymore. Is there any tool that could decompile with ease? thanks

Very likely, but I, for one, wouldn't want to have to trawl through decompiled code, which is often VERY arcane.

Have you tried posting to the forum in question?

Alternatively, branch out a bit and learn to read docs, because if you always rely on code, you may well write your code based on how it's written; and the whole point of Java (and OO) is that you shouldn't do that.

HIH

Winston
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, there are several decompilers available I'm sure. The one I use is called jdgui (jd.benow.ca/).

However I would argue that if you have to go to the length of decompiling code to understand it then I'd be looking for a new library, or even writing it myself.
 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay, thanks for the input guys.
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should also be aware that decompiling is not foolproof. I've decompiled many classes that won't recompile - decompilers seem to have a lot of trouble sorting out complex arrangements of inner classes. Also the generated code can be extremely hard to read especially if the code has been run through an obfuscater.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, in my experience looking at decompiled code may be an effective way to figure something out, but it's not generally efficient. From a 3rd party library I would expect sufficient documentation and javadocs. If they make me reach for a decompiler, it may be time to replace that library if at all possible.
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The one time I made serious use of a decompiler was when I accidentally deleted some source code before I had checked it in to source control. I had a compiled version that I managed to decompile, and with a little effort managed to get my source code back.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!