如何说服 Eclipse 在 Ubuntu 9.04 下为 openjdk 显示 javadoc 文档?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1022877/
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-09-19 13:49:15  来源:igfitidea点击:

How do I convince Eclipse to show javadoc documentation under Ubuntu 9.04 for openjdk?

eclipseubuntujavadoc

提问by Neil Trodden

I'm having a pretty hard time with this!

我在这方面很难受!

I have installed the java documentation at:

我已经在以下位置安装了 java 文档:

file:///usr/share/doc/openjdk-6-jre/api/index.html

file:///usr/share/doc/openjdk-6-jre/api/index.html

And loading that file up does show me all the documentation.

加载该文件确实向我展示了所有文档。

However, I would like to browse it directly from within eclipse and see the documentation when I hover over a class. For example, when I hover over "javax.servlet.http.HttpServletRequest", I would like to see the documentation for it. All I get is:

但是,我想直接从 eclipse 中浏览它,并在将鼠标悬停在类上时查看文档。例如,当我将鼠标悬停在“javax.servlet.http.HttpServletRequest”上时,我想查看它的文档。我得到的是:

Note: This element has no attached source and the Javadoc could not be found in the attached Javadoc.

注意:此元素没有附加的源代码,并且在附加的 Javadoc 中找不到 Javadoc。

Can anyone help correct my dev environment?

任何人都可以帮助纠正我的开发环境吗?

回答by Chris Jester-Young

javax.servlet.http.HttpServletRequestis not part of the OpenJDK, and so the OpenJDK documentation would not contain information on it.

javax.servlet.http.HttpServletRequest不是 OpenJDK 的一部分,因此 OpenJDK 文档不会包含有关它的信息。

You need to install the Servlet APIdocumentation instead, then, in the library section of your Package Explorer tab, right-click servlet-api.jar, and select Properties. You will then be able to select a javadoc location for that.

您需要安装Servlet API文档,然后在包资源管理器选项卡的库部分中,右键单击servlet-api.jar并选择属性。然后,您将能够为此选择一个 javadoc 位置。

Alternatively, for an Ubuntu-friendly solution, install the libservlet2.5-java-docpackage, then add the javadoc to your Servlet API jar file using the procedure above.

或者,对于 Ubuntu 友好的解决方案,安装该libservlet2.5-java-doc软件包,然后使用上述过程将 javadoc 添加到您的 Servlet API jar 文件中。

回答by Phaedrus

Under Properties, you can enter a URL that hosts the servlet API, such as:

在属性下,您可以输入托管 servlet API 的 URL,例如:

http://tomcat.apache.org/tomcat-5.5-doc/servletapi/

http://tomcat.apache.org/tomcat-5.5-doc/servletapi/

回答by Jimmy

A slightly different method is needed for Android projects in Eclipse, where you specify the JavaDoc location in "Java Build Path", rather than "JavaDoc Location"settings. See the answer here, which worked for me:

Eclipse 中的 Android 项目需要一种稍微不同的方法,您可以在"Java Build Path" 中指定 JavaDoc 位置,而不是"JavaDoc Location"设置。请参阅此处的答案,这对我有用:

Problems with javadoc

javadoc 的问题

(The JavaDoc problem started happening to me when I deleted my old Android SDK folder.)

(当我删除旧的 Android SDK 文件夹时,JavaDoc 问题开始发生在我身上。)

回答by Wasim Hossain

The following procedure will enable Java documentation to be available in Eclipse when you hover over some Java class. Download the Java Documentation (this is for version 6) from http://www.google.co.in/url?sa=t&source=web&ct=res&cd=4&ved=0CC0QFjAD&url=https%3A%2F%2Fcds.sun.com%2Fis-bin%2FINTERSHOP.enfinity%2FWFS%2FCDS-CDS_Developer-Site%2Fen_US%2F-%2FUSD%2FViewProductDetail-Start%3FProductRef%3Djdk-6u10-docs-oth-JPR%40CDS-CDS_Developer&ei=T-z3S87CAYuyNq3UweAF&usg=AFQjCNH54wkg50p7PJGmv6dEJd0zxXTGRA&sig2=Pv8-OZ7ZQEAsh89kUFhvUwThis is a zipped file jdk-*-docs.zip ( * indicates the version number, for e.g., 6u18 which implies Java Version 6.18). Open Eclipse. Click on Window > Show View > Javadoc Right click on the Javadoc console. Select Open Input. Click "Change Attached Source". Select "External File". Navigate to the directory in which jdk-*-docs.zip exists. Open it. And there you have it - the entire documentation available to you at your fingertip(mousetip?).

当您将鼠标悬停在某个 Java 类上时,以下过程将使 Java 文档在 Eclipse 中可用。从http://www.google.co.in/url?sa=t&source=web&ct=res&cd=4&ved=0CC0QFjAD&url=https%3A%2F%2Fcds.sun.com%下载 Java 文档(适用于版本 6) 2Fis斌%2FINTERSHOP.enfinity%2FWFS%2FCDS-CDS_Developer站点%2Fen_US%2F-%2FUSD%2FViewProductDetail启动%3FProductRef%3Djdk-6u10中-文档-OTH-JPR%40CDS-CDS_Developer&EI = T-z3S87CAYuyNq3UweAF&USG = AFQjCNH54wkg50p7PJGmv6dEJd0zxXTGRA&SIG2 = PV8 -OZ7ZQEash89kUFhvUw这是一个压缩文件 jdk-*-docs.zip(* 表示版本号,例如,6u18 表示 Java 版本 6.18)。打开日食。单击窗口 > 显示视图 > Javadoc 右键单击​​ Javadoc 控制台。选择打开输入。单击“更改附加源”。选择“外部文件”。导航到 jdk-*-docs.zip 所在的目录。打开它。有了它 - 整个文档都在您的指尖(鼠标提示?)。