Solved

Modify JDK source during eclipse debug

Posted on 2010-11-30
4
557 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
V.simple question about Android packages and libraries 1 38
Desingning Refactoring existing code 2 32
dao vs facade design patterns 2 38
Java array 21 87
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

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