简体   繁体   English

如何在Eclipse中查看Javadoc?

[英]How to view Javadoc in Eclipse?

I am using a third party library, i have included into my project. 我正在使用第三方库,我已经包含在我的项目中。 It contains classes for the application, but no sources, or Javadoc. 它包含应用程序的类,但没有源或Javadoc。 As expected, mouse-over imported object shows no javadoc. 正如所料,鼠标悬停导入的对象不显示任何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 谷歌搜索了一下后,我遇到了3个版本的罐子

  1. app.jar app.jar
  2. app-sources.jar APP-sources.jar
  3. app-javadoc.jar 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). 它出现了,app-javadoc.jar只包含html页面和app-sources只包含.java文件(带有Javadoc注释)。

What i did: 我做了什么:

  • Added all 3 files to the list of "Referenced Libraries". 将所有3个文件添加到“Referenced Libraries”列表中。 After "refresh"ing the project, javadoc still does not show. 在“刷新”项目之后,javadoc仍然没有显示。

  • Additionally, under properties for the project, i pointed "Javadoc location path" to unzipped content of app-javadoc.jar (validated ok) 另外,在项目的属性下,我将“Javadoc位置路径”指向app-javadoc.jar的解压缩内容(已验证确定)

Still, after having done all that, my Eclipse fails to display javadoc. 在完成所有这些之后,我的Eclipse无法显示javadoc。

Please advise 请指教

Thank you. 谢谢。

Add only app.jar to the Referenced Libraries. 仅将app.jar添加到Referenced Libraries。

then, go to Project Explorer, right click on the jar file-> Properties -> Javadoc Location and add Javadoc jar location (app-javadoc.jar). 然后,转到Project Explorer,右键单击jar文件 - > Properties - > Javadoc Location并添加Javadoc jar位置(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. 如果您还想浏览源代码,请在同一对话框中转到“Java Source attachment”,然后在其中添加app-sources.jar。

I think you should set the javadoc location to the library itself but not the Project's javadoc location property. 我认为你应该将javadoc位置设置为库本身,而不是Project的javadoc位置属性。

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. 项目>属性> Java构建路径>库展开app.jar节点并选择“Javadoc位置”子节点,您可以看到库树右侧的“编辑”按钮已启用。 Then click the "Edit" button and you can choose your javadoc in a jar file. 然后单击“编辑”按钮,您可以在jar文件中选择javadoc。

I am using Eclipse not MyEclipse but I think they are similiar. 我使用的是Eclipse而不是MyEclipse,但我认为它们是相似的。 FYI FYI

Here is an answer as of 2016-05-12: 以下是截至2016-05-12的答案:

In the Eclipse Project Explorer, under Referenced Libraries, right click on the jar file for which you require documentation. 在Eclipse Project Explorer中的Referenced Libraries下,右键单击需要文档的jar文件。 In the present example I require documentation for the Apache Commons IO library. 在本示例中,我需要Apache Commons IO库的文档。

在此输入图像描述

Select Properties. 选择属性。 Then select Javadoc Location: 然后选择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. 在我考虑的情况下--Apache Commons IO库 - javadoc jar文件存储在与库jar文件相同的目录中。 In the Properties dialog, select Javadoc in Archive, navigate to the relevant directory, and click on the javadoc jar file: 在Properties对话框中,选择Archive中的Javadoc,导航到相关目录,然后单击javadoc jar文件:

在此输入图像描述

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: 如下所示,当您将光标悬停在Apache Commons IO类名称上时,将显示javadoc:

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM