Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Re: Debug JDK source code
Re: Debug JDK source code [message #642296] Tue, 30 November 2010 12:37 Go to next message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
On 30/11/10 10:55 PM, Al wrote:
> I want to debug the java source code in eclipse.
>
> I am able to attach and see the JDK class files but I want to be able to
> stick a statement into the JDK source code.
> e.g. in Container.addImpl():
> System.out.println ("Container.addImpl(): " + component + "\tindex: " +
> index);
>
> I went to the rt.jar in the package explorer. I right-clicked to get
> Properties, then select Java Source Attachment and then specify a path:
> C:/Program Files/Java/jdk1.6.0_18/src.zip
> but still I get Container.class not Container.java
>
> So then unzipped the src.zip and using that directory as the source
> attachment. I can edit Container.java now in Eclipse at this point. When
> it runs it still uses the class file and the new line appears in the
> Container.class, but I don't see the output on the console.
>
> Something is still not right. How do I do this?
>
> (Note that I'm not looking for a bug in the JDK, just want to see what
> its doing)
>


Question should go to JDT forum. cc-ing.

If I'm not wrong, by attaching the source to a jar, you are merely
saying that is the source of the classes in the jar. It doesn't instruct
Eclipse to compile the source and create class files. That is done only
by having source files under the source folder.


In your case, I would put a breakpoint or a printpoint
( http://thecoderlounge.blogspot.com/2010/06/print-points-debu gging-by-writing-to.html)
That should help.

If you want a really complicated solution, I would suggest AspectJ
weaving ;-)


--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: Debug JDK source code [message #642407 is a reply to message #642296] Wed, 01 December 2010 03:13 Go to previous message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
Prakash G.R. wrote:
> On 30/11/10 10:55 PM, Al wrote:
>> I want to debug the java source code in eclipse.
>>
>> I am able to attach and see the JDK class files but I want to be able to
>> stick a statement into the JDK source code.
>> e.g. in Container.addImpl():
>> System.out.println ("Container.addImpl(): " + component + "\tindex: " +
>> index);
>>
>> I went to the rt.jar in the package explorer. I right-clicked to get
>> Properties, then select Java Source Attachment and then specify a path:
>> C:/Program Files/Java/jdk1.6.0_18/src.zip
>> but still I get Container.class not Container.java
The source attachment is only used to show the original source for the
JAR. It cannot be edited.
>>
>> So then unzipped the src.zip and using that directory as the source
>> attachment. I can edit Container.java now in Eclipse at this point. When
>> it runs it still uses the class file and the new line appears in the
>> Container.class, but I don't see the output on the console.
Probably because the launch configuration has the original rt.jar on the
class path before your source folder.
>>
>> Something is still not right. How do I do this?
Actually, you shouldn't start to mess around with the rt.jar source and
use conditional breakpoints to print out debug info.

Dani
>>
>> (Note that I'm not looking for a bug in the JDK, just want to see what
>> its doing)
>>
>
>
> Question should go to JDT forum. cc-ing.
>
> If I'm not wrong, by attaching the source to a jar, you are merely
> saying that is the source of the classes in the jar. It doesn't
> instruct Eclipse to compile the source and create class files. That is
> done only by having source files under the source folder.
>
>
> In your case, I would put a breakpoint or a printpoint
> ( http://thecoderlounge.blogspot.com/2010/06/print-points-debu gging-by-writing-to.html)
> That should help.
>
> If you want a really complicated solution, I would suggest AspectJ
> weaving ;-)
>
>
Previous Topic:Help on JDT search engine to find the method reference in a project
Next Topic:Java Eclipse - new 'NoOverLook' feature
Goto Forum:
  


Current Time: Fri Apr 18 14:18:56 EDT 2014

Powered by FUDForum. Page generated in 0.08452 seconds