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 src.zip 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/src.zip > OK > OK.

Done!

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

Note also the Javadoc location just under the Source attachment: src.zip.
This is the API on the Oracle website: http://download.oracle.com/javase/7/docs/api/ surprise

We can also do the same for the source of the JUnit framework.
For that, download the sources from this website: https://github.com/KentBeck/junit/downloads

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.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Refresh Type the characters you see in this picture. Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive.  Switch to audio verification.