Eclipse how to link a jar containing javadocs/source with its binary?

回眸只為那壹抹淺笑 提交于 2019-11-27 17:09:22

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...

  1. Right click over the project -> Build path -> Configure build path
  2. In the new window, go to the "Libraries" tab.
  3. Select the library and expand it.
  4. There are 4 child options. Select "Javadoc location" and click the "Edit" button on the right.
  5. Now you can add a jar file containing the docs. This would be just a zip file with the extension changed to jar. Make sure inside the jar the index.html is in the root. You can press the "Validate" button to check everything is ok.

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".

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"/>

raj

The easiest way is :

  1. Press control+(The word for which you want to see the Java doc)
  2. A page will appear that has a button for attach source.Click This
  3. Select External location.
  4. Browse The location to Java folder than your jdk .Than select src .zip.
  5. press OK.

The Problem is Solved.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!