views:

1346

answers:

6

I'd like to get at least one JRE/JDK level on my Windows machine where I have the JRE/JDK source that matches the exact level of the JRE/JDK. My purpose is to be able to go into the system classes while debugging. Any suggestions about how to do this? Thanks in advance.

A: 

The source code is included in the JDK 1.5+ installer. Just make sure that the option is not unchecked while installing.

Joshua
A: 

Just install the JDK. It will install a private JRE too and the source will match.

If you need a specific JDK, see here: http://java.sun.com/products/archive/

Tom
+2  A: 

Most of the useful source will be in the src.zip file in your JDK.

You can get source up to jdk 6u3 from jdk6.dev.java.net. On Linux you can get OpenJDK source and packages from openjdk.java.net.

Tom Hawtin - tackline
You'll probably want JDK classes with debugging info compiled in. Either compile the sources yourself or download the appropriate version. For example JDKu18 currently has a download for the DEBUG version here: http://download.java.net/jdk6/
Brian Harris
The JDK rt.jar at least has source line number debugging information (it appears in stack traces).
Tom Hawtin - tackline
A: 
anjanb
A: 

If you're using eclipse, you can bind the JDK to its source if it is not done automatically. This is done in Window > Preferences > Java > Installed JREs. You edit one of the listed JRE/JDK and for each jar on 'System libraries' you indicate what's the src (you can set the zip that comes with the JDK for instance). This way you can debug any JDK class.

Miguel Ping
+2  A: 

I had this problem for a long time; the source-download site must just not have been maintained for a while there.

It seems fixed now, though:

http://download.java.net/jdk6/6u10/archive/

(Has links for all the JDK 6 source downloads, not just 6u10.)

stacktracer