Attaching Java Source Files to an Eclipse JRE
As per this ubuntu thread, the solution is:
- Window > Preferences > Java > Installed JREs.
- Double click on the JRE for which you want to attach source code.
- Under “JRE System Libraries”, select rt.jar.
- Click on the “Source Attachment…” button.
- Supply a path to the source zip file, e.g. C:/Program Files/Java/jdk1.6.0_23/src.zip
That zip file was already on my system (since the JDK was installed) but some projects were using the JRE rather than the JDK. Therefore, I needed to specify the JDK source zip file for the JREs as well.