Where to get full source code for rt.jar? [closed]
I am searching the source code for rt.jar for Oracle JRE/JDK 6 Update 22. The src.zip, which is included with the delivery, does not contain all sources, for examples the sun.* (e.g. sun.reflect.Reflection) packages are missing.
Where can I get a complete src.zip?
sun.* sources are a part of JDK that is proprietary closed source Sun code (or Oracle since 2010).
Having said that, the package you're interested in (sun.reflect.) happens to be included in OpenJDK 7, and all of OpenJDK source is open.
You can get the source here: http://jdk7src.sourceforge.net/
EDIT 2017-11-22:
This answer was written in 2010 where the world was very different. If you just need the sources for the JRE classes, use the JRE in a JDK build - the included src.zip file is recognized by most modern IDE's.
If you really, really need the full source (if you are unsure, you don't) then find a suitable OpenJDK debug build or build OpenJDK from source.
OLD 2010 ANSWER:
You can download the complete source code for the JDK from http://download.java.net/jdk6/source/
VERY IMPORTANT NOTE: This is under the Java Research License, which may taint you in a way incompatible with what you need to know this for.
If you use Eclipse, here is how you can link to Java source files:
- As Thorbjørn Ravn Andersen mentioned, download the JDK source http://download.java.net/jdk6/source/ , and unzip the tar.gz file to a folder, say 'jdk.src';
- Open your java file that refers to a base java class (say Thread) that comes from the JDK;
- Tap F3 to open declaration, expect Eclipse to open a new tab with "source not found" message. It asks for the rt.jar source location, but you don't need to go through the trouble of compiling the JDK source to get it. Instead, click on the "attach source" button, in the "source attachment configuration" popup window, select "External Folder", then point to jdk.src/jdk/src/share/classes directory. Eclipse will then automatically load the newly found JDK class source code in the same window.
http://jdk7src.sourceforge.net/
AFAIK part of JDK 6 originates from OpenJDK or is integrated into OpenJDK. So maybe you find more insights here:
- http://download.java.net/openjdk/jdk6/
- http://hg.openjdk.java.net/jdk6/jdk6
- http://openjdk.org/
- http://openjdk.java.net/projects/jdk6/