Skip to main content


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 17:37 Go to next message
Prakash G.R. is currently offline Prakash G.R.Friend
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 08:13 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
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: Tue Apr 23 17:34:27 GMT 2024

Powered by FUDForum. Page generated in 0.02929 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top