Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to add breakpoints to a class which I don't have the source code for?

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?)

like image 493
neu242 Avatar asked Aug 19 '09 12:08

neu242


People also ask

How do I add a line of code breakpoint to the source code?

Set breakpoints in source code To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint.

How do you set a class breakpoint?

Click the gutter at the executable line of code where you want to set the breakpoint. Alternatively, place the caret at the line and press Ctrl+F8 .

How do I add a breakpoint to all methods in Intellij?

You can follow the steps below: Run -> View breakpoints -> Add -> Java Method Breakpoints. Class pattern -> full reference of your class (e.g., mypackage. MyClass)


2 Answers

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

like image 71
Rich Seller Avatar answered Sep 21 '22 15:09

Rich Seller


As mentioned by Rich, the outline view (available even without sources):

alt text http://help.eclipse.org/ganymede/topic/org.eclipse.platform.doc.user/images/ref-8.png

allows you to set method breakpoint, that is, provided javac compiled those classes with debug informations, including "Source Code information" (that is the case with J2EE1.4, not sure about J2EE1.3)

The source code of J2EE 1.3 should be available and be included with the download center j2sdkee-1_3_1-win.exe file.

like image 39
VonC Avatar answered Sep 19 '22 15:09

VonC