Solved

Modify JDK source during eclipse debug

Posted on 2010-11-30
4
524 Views
Last Modified: 2012-05-10
I want to debug the java source code in eclipse.
I am able to attach and see the JDK class files (as specified,e.g. here:
http://www.avajava.com/tutorials/lessons/how-do-i-view-and-debug-jdk-source-code-in-eclipse.html?page=3)
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);
How do I do this?

0
Comment
Question by:allelopath
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
Valeri earned 200 total points
ID: 34239821
If you need this, it means that there is something wrong...?!
Anyway, one possible solution is to copy the source of the original java class and to add it to your package. In this way you will use the "local" copy of this class and you will be able to change anything in this class, according to what you need...
0
 
LVL 1

Author Comment

by:allelopath
ID: 34239983
I've now foudn the rt.jar in the package explorer.
I right-click to get Properties, then select Java Source Attachement and then specify a path:
C:/Program Files/Java/jdk1.6.0_18/src.zip
but still I get Container.class not Container.java
0
 
LVL 1

Author Comment

by:allelopath
ID: 34240640
I've also tried unzipped the src.zip and using that as the source attachment.
I can edit Container.java now, but when it runs it still uses the class file.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 300 total points
ID: 34243198
you'll need to add the source to a source folder and make the required changes
then in your eclipse run configuration change the classpath to either remove the jre library or move it after your user code
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
firstChar challenge 13 84
JList custom Cell Renderer refresh 15 43
Java Timer (static) 9 15
Java JRE greater than 1.6 5 21
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now