How do I view and debug JDK source code in Eclipse?
Author: Deron Eriksson
Description: This Java tutorial describes how to debug through Java Development Kit source code in Eclipse.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 1.5.1
(Continued from page 1)
Now, once again we can click on String in our Test class and click F3.
This time, F3 actually brings up the source code for the String class. This is because the JDKW includes source code (in our example, this is at C:\jdk1.5.0_09\src.zip).
As an example of debugging a JDK class, let's add a Vector to our Test class.
If we hit F3 on Vector, this brings up the Vector.class file. In this example, we set a breakpoint in the constructor.
Next, we can fire up our Debug configuration that calls the Test class.
We can see in the stacktrace that the code has hit the breakpoint in the constructor of the Vector. We can then perform various actions like stepping into, stepping over, and stepping out of code, and we can inspect our various variables as this happens.
(Continued on page 3)