How to attach JDK java source code to Eclipse?

If you try to see the code for JDK classes you might get this error:
Source not found. The JAR file …\rt.jar has no source attachment.

To fix this you need to attach the JDK to your IDE.

In Eclipse, select Windows -> Preferences -> Java -> Installed JREs , select the installed JDK, expands rt.jar, select “Source attachment” and find the from your disk drive, which is under the folder your JDK is installed.



Leave a Reply

Your email address will not be published. Required fields are marked *