How to view Javadoc in Eclipse?

自古美人都是妖i 提交于 2020-01-02 00:57:06

问题


I am using a third party library, i have included into my project. It contains classes for the application, but no sources, or Javadoc. As expected, mouse-over imported object shows no javadoc.

Note: This element neither has attached source nor attached 
Javadoc and hence no Javadoc could be found.

After googling for a bit, i came across 3 versions of jars

  1. app.jar
  2. app-sources.jar
  3. app-javadoc.jar

It appears and app-javadoc.jar contains nothing but html pages and app-sources contans nothing but .java files (with Javadoc comments).

What i did:

  • Added all 3 files to the list of "Referenced Libraries". After "refresh"ing the project, javadoc still does not show.

  • Additionally, under properties for the project, i pointed "Javadoc location path" to unzipped content of app-javadoc.jar (validated ok)

Still, after having done all that, my Eclipse fails to display javadoc.

Please advise

Thank you.


回答1:


Add only app.jar to the Referenced Libraries.

then, go to Project Explorer, right click on the jar file-> Properties -> Javadoc Location and add Javadoc jar location (app-javadoc.jar).

If you want to also browse the source code, then go to 'Java Source attachment' in the same dialog box and add the app-sources.jar there.




回答2:


I think you should set the javadoc location to the library itself but not the Project's javadoc location property.

Project > Properties > Java Build Path > Libraries expand the app.jar node and select the "Javadoc location" sub node and you can see the "Edit" button at the right of the library tree is enabled. Then click the "Edit" button and you can choose your javadoc in a jar file.

I am using Eclipse not MyEclipse but I think they are similiar. FYI




回答3:


Here is an answer as of 2016-05-12:

In the Eclipse Project Explorer, under Referenced Libraries, right click on the jar file for which you require documentation. In the present example I require documentation for the Apache Commons IO library.

Select Properties. Then select Javadoc Location:

In the case that I am considering--the Apache Commons IO library--the javadoc jar file is stored in the same directory as the library jar file. In the Properties dialog, select Javadoc in Archive, navigate to the relevant directory, and click on the javadoc jar file:

Click Open, click OK, and you're done. As shown below, when you hover your cursor over an Apache Commons IO class name the javadoc appears:



来源:https://stackoverflow.com/questions/6406300/how-to-view-javadoc-in-eclipse

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