views:

244

answers:

4

I want to add a breakpoint in a class in Eclipse, but I don't have the source code for it. Is it possible to add a breakpoint in it anyway? In my case I really only need to know when a method is called.

(As a side note: does anyone have the source code for j2ee_api_1_3.jar?)

+8  A: 

If you open the outline view, you can select a method, right-click and select Toggle Method Breakpoint, this will then break whenever the method is hit.

You may be able to get the sources from Sun's archive download page

Rich Seller
+1  A: 

It depends, I think, on whether the class was compiled with debug information. If so, then the class file contains meta-data such as line numbers and parameter names which the debugger needs to make a decent fist of it. If not, then the debugger has less information to go on.

JavaEE libraries are notorious for not having debug meta-data compiled into them. It can be quite frustrating.

skaffman
+1  A: 

Download jad decompiler /configure its path in eclipse through windows->preferences and open the source of the class where you need to place the breakpoint - and then debug can run as it does normally and you can see all the variable information in the variable view.

techzen
Jadclipse (http://jadclipse.sourceforge.net) with Jad (http://www.varaneckas.com/jad) solved it for me. Thanks!
neu242
+3  A: 
VonC
Depressingly, my copy of j2ee1.3 hasn't got debug or source code information, and the source code isn't available in the download that you found. (I admire your google-fu for finding it, though :))
neu242