How to attach JDK source code in Eclipse?

To attach JDK source code in Eclipse go to Windows=>Java=>Installed JREs, select your JRE and click on Edit button. In the JRE definition window select rt.jar and click on Source Attachment. Now you should see source attchment configuratin window. Select from JAVA_HOME.

Eclipse jdk source code attachment