Rip javadocs from a doc site to a local zip file

﹥>﹥吖頭↗ 提交于 2019-12-22 01:50:51

问题


I'm wondering if there is any tool to "download" the javadocs from an online host to a local file.

The online docs I am using tend to reject clients such as eclipse, making work difficult, so I need to pull them onto my machine and attach them to my library jar.


回答1:


  1. First, make sure they don't already offer an download in zip form or similar.

  2. Then, make sure you are actually allowed to do this (this may depend on where you live, and on any conditions mentioned on the web site from where you want to pull this).

  3. Then, have a look at the Wget tool. It is part of the GNU system, thus included in many Linux distributions, but also available for Windows and Mac, I suppose.

Something like this works for me:

wget --no-parent --recursive --level=inf --page-requisites --wait=1 
   http://epaul.github.com/jsch-documentation/simple.javadoc/

(without the line break.)

Look up what each option does in the manual before trying this.

This downloads lots of the same copy of the index.html file with appended ?... names (for the FRAMES links on each page). You can remove these files after downloading by adding the --reject 'index.html\?*' option, but they still will be downloaded first (and checked for recursive links). I did not yet find out how to avoid downloading them at all. (See this related question on Serverfault.)

Maybe adding the right recursion level would help here (I didn't try).

After downloading, you might want to zip the resulting directory to take less disk space. Use the zip tool of your choice for this.




回答2:


In this case ... make your own javadocs!

First you need the source. At the time of writing the Java 8 JDK comes with a zip file called src.zip. Sometimes, for unexplained reasons, Oracle don't always include the source. So for some older versions (and who knows about the future) you have to get hold of the Java source in another way. It's worth also being aware that, in the past, Oracle have sometimes included the source with the Linux version of the JDK, but not with the Windows one.

I just unzipped this file... the top directories are "com", "java", "javax", "launcher" and "org". Directory launcher contains no files to document.

You can generate the javadocs very very simply from any or all of these by CD'ing at the command prompt/terminal to the directory ...\src. Then go

javadoc -d docs -Xmaxwarns 10 -Xmaxerrs 10 -Xdoclint:none -sourcepath . -subpackages java:javax:org:com

NB note that there is a "." after -sourcepath

Simple as that. Generating your own javadocs also has the huge advantage that you know they are precisely the right javadocs for the JDK you are using on your system.

The same applies to documenting any and all Java .jars (with source) which you use. However, all versions of most jars will be found with their documentation available for download at Maven Central http://search.maven.org...




回答3:


For the download of latest java documentation(jdk-8u77) API

Navigate to http://www.oracle.com/technetwork/java/javase/downloads/index.html

Under Addition Resources and Under Java SE 8 Documentation
Click Download button

Under Java SE Development Kit 8 Documentation > Java SE Development Kit 8u77 Documentation

Accept the License Agreement and click on the download zip file

Unzip the downloaded file Start the API docs from jdk-8u77-docs-all\docs\api\index.html

For the other java versions api download, follow the following steps.

Navigate to http://docs.oracle.com/javase/

From Release dropdown select either of Java SE 7/6/5

In corresponding JAVA SE page and under Downloads left side menu Click JDK 7/6/5 Documentation or Java SE Documentation

Now in next page select the appropriate Java SE Development Kit 7uXX Documentation.

Accept License Agreement and click on Download zip file

Unzip the file and Start the API docs from
jdk-7uXX-docs-all\docs\api\index.html



来源:https://stackoverflow.com/questions/6597562/rip-javadocs-from-a-doc-site-to-a-local-zip-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!