你如何阅读JavaDoc?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/73366/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 07:58:14  来源:igfitidea点击:

How do you read JavaDoc?

javadocumentationjavadoc

提问by jrudolph

What tools/websites do you use to read JavaDocs?

您使用哪些工具/网站来阅读 JavaDocs?

I currently use Firefox with 20+ tabs open when working on a J2EE project to have all the documentation available which is not very usable, is eating too much memory and is not searchable.

我目前在处理 J2EE 项目时使用 Firefox 并打开 20 多个选项卡,以获得所有可用的文档,这些文档不是很可用,占用太多内存并且无法搜索。

What I would expect from such a tool/website:

我对这样的工具/网站的期望:

  • Aggregate JavaDocs from different locations
  • Direct access to types like Ctrl+T in Eclipse or similar
  • Fulltext search
  • Cross referencing between all the Java libraries I've chosen
  • For a tool: offline support
  • Speed
  • 聚合来自不同位置的 JavaDocs
  • 直接访问 Eclipse 中的 Ctrl+T 等类型或类似的类型
  • 全文检索
  • 我选择的所有 Java 库之间的交叉引用
  • 对于工具:离线支持
  • 速度

not mandatory:

不是强制性的:

  • possibility to annotate things
  • support for different versions of a library (+ diffing ?)
  • IDE integration
  • 注释事物的可能性
  • 支持不同版本的库(+ diffing ?)
  • 集成开发环境

Edit:

编辑:

Thanks for your answers. I knew most of the sites but gave them another try. Here is my judgement:

感谢您的回答。我知道大多数网站,但又给了他们一次尝试。这是我的判断:

  • built-in Eclipse/IDE features
    • tightly integrated
    • offline/online support
  • javadoconline.com(no longer maintained)
    • works
    • clean looks
    • finds matches in more than one version of the api and allows easy switching
    • simple but working
    • fast
  • jdocs(offline)
    • seems very sophisticated
    • sometimes slow
    • some recent versions of libraries seem to be missing (Seam 2.0.0, Hibernate Validators) but it looks like you can add them yourself
    • IDE integration (not tested)
    • wiki style comments to each item
  • docjar.com
    • works
    • fast
    • cluttered UI
  • javadoc_isearch
    • greasemonkey script for firefox which makes navigating javadocs easier
    • works smooth and perfectly
  • 内置 Eclipse/IDE 功能
    • 紧密集成
    • 离线/在线支持
  • javadoconline.com(不再维护)
    • 作品
    • 干净的外表
    • 在多个版本的 api 中查找匹配项并允许轻松切换
    • 简单但有效
    • 快速地
  • jdocs(离线)
    • 看起来很老练
    • 有时慢
    • 似乎缺少一些最新版本的库(Seam 2.0.0、Hibernate Validators),但您似乎可以自己添加它们
    • IDE 集成(未测试)
    • 每个项目的维基风格评论
  • docjar.com
    • 作品
    • 快速地
    • 杂乱的用户界面
  • javadoc_isearch
    • firefox的greasemonkey脚本,使导航javadocs更容易
    • 工作流畅完美

回答by Heath Borders

Eclipse integrates well with Javadoc and has an HTML-like viewer for it. You can attach source and javadoc to binaries that will show up when you select a class.

Eclipse 与 Javadoc 集成良好,并为它提供了一个类似 HTML 的查看器。您可以将源代码和 javadoc 附加到将在您选择类时显示的二进制文件。

回答by mmattax

Doxygen (http://www.doxygen.nl/) might fit the bill.

Doxygen ( http://www.doxygen.nl/) 可能符合要求。

EDIT: I may have misread your question, doxygen is a tool to generate documentation and models based off your code and javadoc.

编辑:我可能误读了您的问题,doxygen 是一种根据您的代码和 javadoc 生成文档和模型的工具。

回答by mmattax

Something like this may be useful?

像这样的东西可能有用吗?

http://www.docjar.com/

http://www.docjar.com/

回答by Rob Dickerson

Personally, I've never had a problem with the built-in javadoc browsing tools offered by my IDE.

就我个人而言,我的 IDE 提供的内置 javadoc 浏览工具从来没有遇到过问题。

Currently, I use IntelliJ Idea -- Ctl-Q brings up the javadoc for the method under the cursor, with the hyperlinks to other parts of the documentation functional.

目前,我使用 IntelliJ Idea -- Ctl-Q 为光标下的方法调出 javadoc,并带有指向文档其他部分的超链接。

I would imagine NetBeans and Eclipse offer similar functionality.

我想 NetBeans 和 Eclipse 会提供类似的功能。

回答by Swati

I use http://www.teria.com/~koseki/tools/gm/javadoc_isearch/for FF. Lets me easily browse other libraries as well.

我使用http://www.teria.com/~koseki/tools/gm/javadoc_isearch/为 FF。让我也可以轻松浏览其他库。

回答by Michael

If you use Eclipse, it offers support for Javadocs. For example, hovering your mouse over a method call will display a tooltip showing you the Javadoc for that method. Documentation for the core Java classes are supported out of the box. However, if your project uses any additional libraries (JAR files), some configuration is required in order to plug their Javadocs into Eclipse.

如果您使用 Eclipse,它会提供对 Javadocs 的支持。例如,将鼠标悬停在方法调用上将显示一个工具提示,显示该方法的 Javadoc。开箱即用地支持核心 Java 类的文档。但是,如果您的项目使用任何其他库(JAR 文件),则需要进行一些配置才能将其 Javadoc 插入 Eclipse。

  1. Go to the "Java Build Path" section of your project properties.
  2. Go to the "Libraries" tab and click the "plus" icon next to the JAR file.
  3. Click "Javadoc location", then the "Edit..." button.
  1. 转到项目属性的“Java 构建路径”部分。
  2. 转到“库”选项卡,然后单击 JAR 文件旁边的“加号”图标。
  3. 单击“Javadoc 位置”,然后单击“编辑...”按钮。

This will let you specify where the Javadocs for that JAR are located. It will even let you specify a website URL, so you don't have to download the Javadocs yourself!

这将让您指定该 JAR 的 Javadoc 所在的位置。它甚至可以让您指定网站 URL,因此您不必自己下载 Javadoc!

回答by Léo Léopold Hertz ??

You can find Stanford University's JavaDoc here.

您可以在此处找到斯坦福大学的 JavaDoc 。

回答by gavenkoa

Hm... How about:

嗯...怎么样:

  • http://edu.netbeans.org/quicktour/javadoc.html- NetBeans supports the Javadoc standard for Java documentation - both viewing it and generating it.
  • http://globaldocs.zeevbelkin.com/- This application allows to conveniently browse, over the Internet and local filesystem, multiple javadoc sets, using a single packages/classes hierarchy tree and a searchable index. The viewer supports local and remote docsets (the local docsets, packed to JAR/ZIP-files also are supported).
  • http://edu.netbeans.org/quicktour/javadoc.html- NetBeans 支持 Java 文档的 Javadoc 标准 - 查看和生成它。
  • http://globaldocs.zeevbelkin.com/- 此应用程序允许使用单个包/类层次结构树和可搜索索引,通过 Internet 和本地文件系统方便地浏览多个 javadoc 集。查看器支持本地和远程文档集(也支持打包到 JAR/ZIP 文件的本地文档集)。

I prefer NetBeans as it get JavaDocfrom Maven~/.m2directory automatically...

我更喜欢 NetBeans,因为它会自动从Maven目录中获取JavaDoc...~/.m2

回答by Rohit deol

Eclipse is a best way to see the javadocs. Hovering the mouse on method or any declaration you will get automatically generated javadocs by eclipse.

Eclipse 是查看 javadoc 的最佳方式。将鼠标悬停在方法或任何声明上,您将获得 eclipse 自动生成的 javadoc。

回答by Glenn Lawrence

This plug in for Firefox and Chrome is useful for quickly finding package and class names, though it's not a full text search: https://code.google.com/p/javadoc-search-frame/

这个 Firefox 和 Chrome 插件对于快速查找包和类名很有用,尽管它不是全文搜索:https: //code.google.com/p/javadoc-search-frame/