Solved

Modify JDK source during eclipse debug

Posted on 2010-11-30
4
564 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.

726 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