Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 605
  • Last Modified:

Modify JDK source during eclipse debug

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
allelopath
Asked:
allelopath
  • 2
2 Solutions
 
ValeriCommented:
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
 
allelopathAuthor Commented:
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
 
allelopathAuthor Commented:
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
 
objectsCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now