openjdk 8: 错误 - 未找到 public 或受保护的 类 文档

openjdk 8: error - No public or protected classes found to document

我在 Debian,并且已经安装了 OpenJDK 8 以及软件包 openjdk-8-docdefault-jdk-doc;但是,每当我向 javadoc 实用程序指定 class 或包名称时,我都无法查看 JDK 8 API 的 class 的任何文档,这无法显示文档抛出以下错误:

  1. ArrayList 案例:

    kais@debian:~$ javadoc ArrayList
    Loading source files for package ArrayList...
    javadoc: warning - No source files for package ArrayList
    Constructing Javadoc information...
    javadoc: warning - No source files for package ArrayList
    javadoc: error - No public or protected classes found to document.
    1 error
    2 warnings
    kais@debian:~$ javadoc java.lang.ArrayList
    Loading source files for package java.lang.ArrayList...
    javadoc: warning - No source files for package java.lang.ArrayList
    Constructing Javadoc information...
    javadoc: warning - No source files for package java.lang.ArrayList
    javadoc: error - No public or protected classes found to document.
    1 error
    2 warnings
    
  2. J面板案例:

    kais@debian:~$ javadoc JPanel
    Loading source files for package JPanel...
    javadoc: warning - No source files for package JPanel
    Constructing Javadoc information...
    javadoc: warning - No source files for package JPanel
    javadoc: error - No public or protected classes found to document.
    1 error
    2 warnings
    kais@debian:~$ javadoc javax.swing.JPanel
    Loading source files for package javax.swing.JPanel...
    javadoc: warning - No source files for package javax.swing.JPanel
    Constructing Javadoc information...
    javadoc: warning - No source files for package javax.swing.JPanel
    javadoc: error - No public or protected classes found to document.
    1 error
    2 warnings
    kais@debian:~$ javadoc javax.swing
    Loading source files for package javax.swing...
    javadoc: warning - No source files for package javax.swing
    Constructing Javadoc information...
    javadoc: warning - No source files for package javax.swing
    javadoc: error - No public or protected classes found to document.
    1 error
    2 warnings
    

这在我看来很奇怪,因为安装包 openjdk-8-doc 应该包含 javadoc ..

所需的文档

有什么想法吗?

Javadoc 工具应该从 Java 源中创建 Javadoc。它不是显示特定 class 的 javadoc 的工具。 JVM 中 classes 的 Java 文档可在 Oracle or can be browsed online.

下载

正如您在问题中所说,您 "installed" 对应 JDK 的文档,因此无需再次下载或在线浏览,您可以更改为 "installation directory"打开文档包的 index-html 文件,该文件应该位于其根目录中。