views:

288

answers:

3

Hi,

I like to see what a method in the Java API does. So I want the JDK Source Code. Before I re-installed Linux I had the scr.sip file with all the code in it. I just had to tell Eclipse this file and I could see the code. But now I haven't the file anymore...

So the question is: Where can I find it?
Please don't paste the Google results here. I searched already long, but I can't find it... I need just that file. Please be sure if it is the correct file before you answer. Answering by giving an URL is enough for me.

Thanks in advance
Martijn

+3  A: 

You haven't said which version you want, but the JDK 6 source code can be downloaded here, and JDK 7 here.

Additionally you can use the Mercurial servers: 6 7

Jon Skeet
Yes; lets say I want 6 and then on that download page, what to I have do download? The big file `jdk-6u21-ea-src-b04-jrl-05_may_2010.jar, 136.48 MB`? I already downloaded that one. But doesn't contain the source code.
Martijn Courteaux
@Martijn: Did you try downloading the big jar file and then reading the README inside it? Basically you just run it with `java -jar jdk-6u21-ea-src-b04-jrl-05_may_2010.jar`. It will extract the source.
Jon Skeet
See also http://stackoverflow.com/questions/2803498/where-do-i-find-the-javax-crypto-source-code/
polygenelubricants
@Jon: Yes, I did it. And I extracted it like you wrote. But there is no source jar or zip in it.
Martijn Courteaux
@Martijn: You don't extract the jar file - you execute it. That then extracts the source to whichever directory you want. You don't end up with a zip or jar file - you end up with the source in your file system. You can then tell Eclipse to use that.
Jon Skeet
+1  A: 

This file is contained in the standard JDK download. Also your Linux system probably have JDK in the repository. In my Ubuntu Linux file is located here: /usr/lib/jvm/java-6-sun-1.6.0.20/src.zip

vsb
Aha! Can you post which packages you have installed for your Java VM and JDK, please. Because I don't have that folder.
Martijn Courteaux
I installed sun-java6-jdk.
vsb
A: 

Yes!! Got it!

I downloaded the Java Developer Kit (JDK) from sun.com for Linux. There was src.zip in. But first I uninstalled all Java packages with synaptic.

Martijn Courteaux