Eclipse - Java - Source attachment

It's really annoying when you want to browse throw a javadoc but Eclipse doesn't know where to find these sources.

The more difficult thing is to find these source files.

But with the JDK7 it is now easy.
Go until your directory where you have installed it.
For example, let's assume it is C:/soft/java32/jdk1.7.0.
You will find a file.

This is the file to open all classes present in your, for example, rt.jar file.

To use them, open Eclipse, then select a project then > Project > Properties > Java Build Path > Libraries tab > JRE System Library [JavaSE-1.7] > rt.jar > Source attachment: > Edit > C:/soft/java32/jdk1.7.0/ > OK > OK.


This is exactly the same for all others .jar and attachment sources.

Note also the Javadoc location just under the Source attachment:
This is the API on the Oracle website: surprise

We can also do the same for the source of the JUnit framework.
For that, download the sources from this website:

Then do the same as before for the junit-4.10-src.jar file!

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.