Eclipse 中的离线 Java API 文档?

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

Off-Line Java API Documentation in Eclipse?

javaeclipseofflinejava-api

提问by snoofkin

Is there an integration of any other off line way to get the Java API docs?

是否有任何其他离线方式的集成来获取 Java API 文档?

回答by jhurtado

If you have no internet connection on your development machine, or if you want to stop the Web traffic for accessing the documentation, you can store the documentation on your local hard drive.

如果您的开发机器上没有 Internet 连接,或者如果您想停止访问文档的 Web 流量,您可以将文档存储在本地硬盘驱动器上。

  1. Start your favorite Web browser and navigate to http://www.oracle.com/technetwork/java/javase/downloads/index.html#docs
  2. Find your desired documentation, accept the license agreement, and then click the link displayed under the Downloadheader.
  3. In Eclipse, open the Windowmenu, then select Preferences.
  4. In the search bar, type jre, and then click Installed JREs.
  5. Select the one named java, or another term like jre1.8.0_181.
    • Its type must be Standard VM.
  6. Click the Editbutton.
  7. In the JRE system librariessection, select the library ending with rt.jar, and click the Javadoc Location...button.
  8. Mark the Javadoc in archiveradio button.
  9. In the Archive pathfield, enter or Browsefor your full documentation path (e.g. /home/docs/jdk-8u181-doc.zip).
  10. In the Path within archivefield, enter or Browsefor the location of the api/index.htmlfile (e.g. docs/api).
  11. Click the Validatebutton to ensure everything is set correctly.
  12. Click the OKbutton, then the Finishbutton, and finally the Apply & Closebutton. Your documentation is now linked to the file you specified.
  1. 启动您喜欢的 Web 浏览器并导航到http://www.oracle.com/technetwork/java/javase/downloads/index.html#docs
  2. 找到所需的文档,接受许可协议,然后单击Download标题下显示的链接。
  3. 在 Eclipse 中,打开Window菜单,然后选择Preferences
  4. 在搜索栏中,键入jre,然后单击Installed JREs
  5. 选择一个命名的java,或另一个类似的术语jre1.8.0_181
    • 它的类型必须是Standard VM.
  6. 单击Edit按钮。
  7. 在该JRE system libraries部分中,选择以 结尾的库rt.jar,然后单击Javadoc Location...按钮。
  8. 标记Javadoc in archive单选按钮。
  9. 在该Archive path字段中,输入 或Browse作为您的完整文档路径(例如/home/docs/jdk-8u181-doc.zip)。
  10. 在该Path within archive字段中,输入 或Browse作为api/index.html文件的位置(例如docs/api)。
  11. 单击Validate按钮以确保一切设置正确。
  12. 单击OK按钮,然后单击按钮,Finish最后Apply & Close单击按钮。您的文档现在已链接到您指定的文件。

回答by davwise

Just a quick contribution: Instead of selecting 7 "Javadoc in archive", I changed the javadoc location path (URL) to my directory, where I have unzipped my doc. Hope its help!!!

只是一个快速的贡献:我没有选择 7 个“存档中的 Javadoc”,而是将 javadoc 位置路径 (URL) 更改为我的目录,在那里我解压缩了我的文档。希望它的帮助!!!

回答by Lucho

This worked for me (Java 8):

这对我有用(Java 8):

  1. Go to your JDK installation. (C:\Program Files\Java\jdk1.8.0_66for me).

  2. Unzip the src.zipfile (becomes C:\Program Files\Java\jdk1.8.0_66\src\for me).

  3. In the Eclipse editor window: CTRL + Clickon a java.langlibrary class. (something like String).

  4. Eclipse will complain Source not foundand tell you that you don't have the source.

  5. Click Attach source-> External Location-> External Folder.

  6. Find your source folder (C:\Program Files\Java\jdk1.8.0_66\src\for me).

  7. Click OK-> OK.

  8. Enjoy.

  1. 转到您的 JDK 安装。(C:\Program Files\Java\jdk1.8.0_66对我来说)。

  2. 解压缩src.zip文件(C:\Program Files\Java\jdk1.8.0_66\src\对我来说)。

  3. 在 Eclipse 编辑器窗口中:CTRL + Click在一个java.lang库类上。(类似的东西String)。

  4. Eclipse 会抱怨Source not found并告诉您您没有源。

  5. 单击Attach source-> External Location-> External Folder

  6. 找到你的源文件夹(C:\Program Files\Java\jdk1.8.0_66\src\对我来说)。

  7. 单击OK-> OK

  8. 享受。