Accepted answer

you need to have the jdk installed. then you can look in jdk_install_dir\

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.


you can use 'eclipse class decompiler integrates jd, jad,' from eclipse marketplace.

from the find box in the eclipse marketplace write: 'jad' and you would find it.

score:0 file is present in installed jdk folder : ..\program files\java\jdk1.8.0_131

provide this path on the screen showing attach source... worked for me.


we can see c:\program files\java\jdk1.8.0_73\ where c:\program files is a home directory where i have installed the java.

in eclipse, it will show like source not found. form there link will come like browse source. browse the link c:\program files\java\jdk1.8.0_73\ and attach it. now you can see your source code.


@jjnguy suggestion worked for me. but make sure you have also changed the default compiler as well. right clickon th project-->java compiler->click on the link under jdk compliance(right section).


outside eclipse you can see the jdk sources on on this page you can switch from the oficial api documentation to the source code and viceversa.


if you can't find the actual source you can also use a decompiler to regenerate source from the class file.

personally i use jad combined with the jadclipse plugin to view source in eclipse.


right click on the project -> build path -> configure build path. now edit your jre > select 2nd option alternate jre -> select any jdk (not jre). finish, now open any class by ctrl + click, its source code will display.


for ubuntu, install openjdk-6-source and use /usr/lib/jvm/java-6-openjdk/


you can go to and download the latest builds of the openjdk project. i think this should give you what you need.


you should be able to see "jre system library [jdk1.x.xxxx]" when you look at your project's java build path.

you can access the project build path configuration screen by: right clicking on the project -> build path -> configure build path... you should be able to see the jre system library entry at the bottom of the list.

the easiest way to view the source for the class is to use the "open type" shortcut. the default for this shortcut is: ctrl + shift + t". the class you're looking for should appear as you type it's name.


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.


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 file from your jdk installation directory ( this should do the trick

Related Query

More Query from same tag