How to create Html5 compliant Javadoc in Java 9?

JavaObject Oriented ProgrammingProgramming

Before Java 9, we have to search in google to find out particular packages, class, interface, and method information. Since Java 9, Javadoc includes search options in the API documentation itself, and the output is HTML5 compliant.

In the below example, we have created the "JavaDocTest.java" file in the "C:/JAVA" folder.

Example

public class JavaDocTest {
   /**
      * Default method to be run to print
      * Tutorialspoint 
      * @param args command-line arguments
   */
   public static void main(String args[]) {
      System.out.println("Tutorialspoint");
   }
}

The documentation generated by Java 9 is compatible with the HTML5 standard. By using the "-html5" parameter in the jdk 9 Javadoc command allows the generated document to support the HTML5 standard.

C:\JAVA>javadoc -d C:/JAVA -html5 JavaDocTest.java
Loading source file JavaDocTest.java...
Constructing Javadoc information...
Standard Doclet version 9.0.4
Building tree for all the packages and classes...
Generating C:\JAVA\JavaDocTest.html...
Generating C:\JAVA\package-frame.html...
Generating C:\JAVA\package-summary.html...
Generating C:\JAVA\package-tree.html...
Generating C:\JAVA\constant-values.html...
Building index for all the packages and classes...
Generating C:\JAVA\overview-tree.html...
Generating C:\JAVA\index-all.html...
Generating C:\JAVA\deprecated-list.html...
Building index for all classes...
Generating C:\JAVA\allclasses-frame.html...
Generating C:\JAVA\allclasses-frame.html...
Generating C:\JAVA\allclasses-noframe.html...
Generating C:\JAVA\allclasses-noframe.html...
Generating C:\JAVA\index.html...
Generating C:\JAVA\help-doc.html...

Executing the above command can generate a document page under the "C:/JAVA" folder as shown below:

raja
Updated on 20-Apr-2020 10:20:55

Advertisements