How do I view JRE's source code in Eclipse?

When you are coding in Eclipse, press CTRL and click on any core Java class name in your source. Eclipse will now show a screen saying you don't have the sources installed. However, in this screen there is a link saying "Attach source...". Click that link and import the src.zip file from your JDK installation directory (src.zip). This should do the trick


You need to have the JDK installed. Then you can look in JDK_INSTALL_DIR\src.zip

For me it is C:\Program Files\java\jdk1.6.0_11\ (depends on your current version)

You don't need to get a special open source version.


There are a few good answers here on where to get the source. But a word of caution: I'd be wary about how you use it (if you're using it simply for reference). The API documentation is the only contract you should code against, and is what the developers will keep consistent/intact between releases. I wouldn't use the source find out implementation details and then code my applications with regard to those implementation details, as they may change between releases.