Attach the Java Source Code
Solution 1:
Normally, if you have installed the JDK6u14, eclipse should detect it and declare it automatically in its "installed JRE" list.
If not, you can add that JDK through "Windows/Preferences": Java > Installed JREs
:
Just point to the root directory of your JDK installation: it should include the sources of the JDK (src.zip
), automatically detected and attached to rt.jar
by eclipse.
Solution 2:
You don't necessarily need to add the source, but you rather may need to remove a JRE that does not have the source attached.
On looking at the "installed JRE's" I saw that my JDK was setup properly with source, but the default JRE on the machine had no sources. Eclipse was defaulting to that when looking for source.
I just used the remove button to expel the JRE, leaving my JDK. I then hit F3 and the source was there. Yeah!
Solution 3:
Hold ctrl key and then click on class of which you want to see the inner working (for ex: String
) then you will find there button "Attach Source". Click on it. Then click on External Folder. Then browse to your jdk location, per instance C:\Program Files\Java\jdk1.6.0
. That's it.