Reputation: 883
I would like to have the javadoc comments contained in a jar file show in eclipse when I hover over a class.
For example, after downloading JODA-2.0, three jars are obtained:
In eclipse, [right click project -> Properties -> Java Build Path -> Libraries -> ADD JARs...] includes the binary in the project (can reference those classes) for joda-time-2.0.jar.
But how can I link in the sources/javadoc comments contained in the other two jar files so that when I hover over those classes I see the javadocs?
Adding the other two jars (joda-time-2.0-javadoc.jar and joda-time-2.0-sources.jar) to the build path does not link the javadocs or the source.
Upvotes: 82
Views: 66561
Reputation: 1
The easiest way is :
jdk
.Than select
src
.zip.The Problem is Solved.
Upvotes: 0
Reputation: 196
You can also edit the classpathentry in the file ".classpath" in your eclipse project. This can be helpful if you want to modify many entries at once or if you want to generate the path. e.g.:
<classpathentry kind="var" path="HOME/3rdparty/junit.jar" sourcepath="/SOURCE/junit_src.zip"/>
Upvotes: 9
Reputation: 28199
Upvotes: 72
Reputation: 5436
You can try to CTRL + click on a class that has no source attached (do that in editor). When it shows you some info about the class you'll see the button that guides to attach source dialog. Click it and in dialog that pops up pick the source/javadoc location for your class.
You can also do that from project build path settings you are mentioning: pick libraries tab, expand the library (jar) you want and you'll be offered to pick: source attachment, javadoc attachment, native library location, etc. You just pick whatever you want and edit its current settings.
Or you can do as @JB Nizet said...
Upvotes: 67
Reputation: 692231
Right-click on the jar (the one with the class files), choose "Properties", the "Javadoc location", and choose the jar file with the javadoc. Do similarly for the source jar, using "Java source attachment".
Upvotes: 11