From the Oracle/Sun web site:
Over the past several years, Sun has made the source code available via the Sun Community Source License (SCSL) terms. Sun continues to use SCSL for JDK 5.0. In addition, Sun is also releasing JDK 5.0 under the new Java Research License (JRL) which simplifies access to JDK 5.0 source code. Researchers and universities should find the JRL much easier to understand and work with compared to SCSL.
You can download the source (with either license) using the links on that page, but you'll need to sign up for an account first.
This applies to JDK 5. I'm not sure how this will work with JDK 6.