views:

86

answers:

5

I have no problems finding JREs, JDKs and documentation for core Java SE packages, but I'm not sure where to get the source (.java) files. I'm looking for the latest stable release, not bleeding-edge development code. Where are those available?

+4  A: 

The source comes with the Java SDK, in the top-level directory, in the file src.zip. It does not come with the JRE.

Jonathan Feinberg
I meant to specify in my question that I was looking for a website, but this is the best answer for the question I actually asked. +1/accepted.
Lord Torgamus
+5  A: 

From here:

http://download.java.net/jdk6/source/

davidrobles
A: 

There should be an SRC directory in your JDK folder (Perhaps a ZIP. I can't remember exactly)

Chathuranga Chandrasekara
It's a zip (src.zip).
Andreas_D
A: 

If you're using eclipse (I really recommend an IDE for Java Programming!) and have a JDK on your machine, just create a Java project, use the JDK as Java library, create a "Hello world" 'application', put the caret on 'System' (from System.out.println("Hello world");), press F3, then you either see the source code for java.lang.System or you have to press the button on that ugly, unreadable bytecode page once. (It works with any other IDE as well, just the steps are different)

If not ... unzip src.zip, but that less fun.

Andreas_D
+1  A: 

Now that other people have had a chance to respond... I actually found my solution just before I posted this question. I'm a brand-new fan of docjar, which has code and Javadoc for Java SE and other open source projects as well.

I also found (David's answer) helpful.

EDIT: I've just come across Jarvana, which contains some code that docjar doesn't, including the source for the Wicket framework.

Lord Torgamus
You're right. That's what I frequently use for SO when I don't have a machine with eclipse at hand.
Andreas_D