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
Off-Line Java API Documentation in Eclipse?
提问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 流量,您可以将文档存储在本地硬盘驱动器上。
- Start your favorite Web browser and navigate to http://www.oracle.com/technetwork/java/javase/downloads/index.html#docs
- Find your desired documentation, accept the license agreement, and then click the link displayed under the
Download
header. - In Eclipse, open the
Window
menu, then selectPreferences
. - In the search bar, type
jre
, and then clickInstalled JREs
. - Select the one named
java
, or another term likejre1.8.0_181
.- Its type must be
Standard VM
.
- Its type must be
- Click the
Edit
button. - In the
JRE system libraries
section, select the library ending withrt.jar
, and click theJavadoc Location...
button. - Mark the
Javadoc in archive
radio button. - In the
Archive path
field, enter orBrowse
for your full documentation path (e.g./home/docs/jdk-8u181-doc.zip
). - In the
Path within archive
field, enter orBrowse
for the location of theapi/index.html
file (e.g.docs/api
). - Click the
Validate
button to ensure everything is set correctly. - Click the
OK
button, then theFinish
button, and finally theApply & Close
button. Your documentation is now linked to the file you specified.
- 启动您喜欢的 Web 浏览器并导航到http://www.oracle.com/technetwork/java/javase/downloads/index.html#docs
- 找到所需的文档,接受许可协议,然后单击
Download
标题下显示的链接。 - 在 Eclipse 中,打开
Window
菜单,然后选择Preferences
。 - 在搜索栏中,键入
jre
,然后单击Installed JREs
。 - 选择一个命名的
java
,或另一个类似的术语jre1.8.0_181
。- 它的类型必须是
Standard VM
.
- 它的类型必须是
- 单击
Edit
按钮。 - 在该
JRE system libraries
部分中,选择以 结尾的库rt.jar
,然后单击Javadoc Location...
按钮。 - 标记
Javadoc in archive
单选按钮。 - 在该
Archive path
字段中,输入 或Browse
作为您的完整文档路径(例如/home/docs/jdk-8u181-doc.zip
)。 - 在该
Path within archive
字段中,输入 或Browse
作为api/index.html
文件的位置(例如docs/api
)。 - 单击
Validate
按钮以确保一切设置正确。 - 单击
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):
Go to your JDK installation. (
C:\Program Files\Java\jdk1.8.0_66
for me).Unzip the
src.zip
file (becomesC:\Program Files\Java\jdk1.8.0_66\src\
for me).In the Eclipse editor window:
CTRL + Click
on ajava.lang
library class. (something likeString
).Eclipse will complain
Source not found
and tell you that you don't have the source.Click
Attach source
->External Location
->External Folder
.Find your source folder (
C:\Program Files\Java\jdk1.8.0_66\src\
for me).Click
OK
->OK
.Enjoy.
转到您的 JDK 安装。(
C:\Program Files\Java\jdk1.8.0_66
对我来说)。解压缩
src.zip
文件(C:\Program Files\Java\jdk1.8.0_66\src\
对我来说)。在 Eclipse 编辑器窗口中:
CTRL + Click
在一个java.lang
库类上。(类似的东西String
)。Eclipse 会抱怨
Source not found
并告诉您您没有源。单击
Attach source
->External Location
->External Folder
。找到你的源文件夹(
C:\Program Files\Java\jdk1.8.0_66\src\
对我来说)。单击
OK
->OK
。享受。