Java 9 – Javadoc Improvement

Java has upgraded its Javadoc for better user interaction and user-experience. It includes a simplified search, HTML generator, Doclet API, etc.

What is Javadoc

The Javadoc is a tool like javac and a part of JDK. It is used to generate HTML documentation of Java source code. If you ever visit to oracle site you will see the Java documentation which is generated by Javadoc. The upgraded Javadoc has the following features.

Simplified Doclet API

In Java 9, old Doclet API has been replaced with a new simplified API. Although the existing API is still supported and available but you can use the new Doclet API.

Support for HTML5

It supports the HTML5 for better user interface and tools. So the new Javadoc is based on HTML5 version.

Improved Search

Javadoc provides a new search box to find class, packages, methods. It provides better suggestion and accurate search in a moment.

Support for Module System

It helps to generate documentation based on new Java platform module system.
Let’s take an example.

How to create HTML Javadoc from Java source file.

Let’s create an example to generate new HTML5 documentation from a Java source file. Here, we created a Calculate class that contains some methods.

Run Javadoc Command

To create Javadoc, use the following command. execute it using cmd or terminal after reaching to Java file location.

It will generate populate some messages to the console which are processing instructions.

Now open the directory in which file is stored. You will find several html files there, open index.html file into the browser and the page would be like this.

Click on the Calculate class and you will see the class structure.

Scroll down the page and you will see the list of method belongs to Calculate class.

And you can see a new search box, search here with any text and you will get the suggestions.

Well, this is all about Javadoc, It is easy and good tool to create a informative HTML doc using Source code.

Was this post helpful?

Related Posts

  • 12 October

    Java 9 JShell tutorial

    Table of ContentsHello World Example Using JShellWhat can we do with JShell?How to start and stop JShell?Creating variable in JShellJShell as a CalculatorCreating Methods in JShellCreating Class in JShellExecuting Algebraic Expressions in JShellExecuting Conditional Statements in JShellJShell CommandsList the VariablesList the MethodsImport Java PackagesCheck history of commandsEdit code in JShell Edit PadLoad external Java code […]

  • 11 October

    Java 9: Stream API Improvements

    Table of ContentsThe takeWhile() MethodExampleThe dropWhile() MethodExampleThe ofNullable() MethodExampleThe iterate() MethodExampleWas this post helpful? In Java 9, following methods are added to Stream interface of stream package. These methods are default and static. The takeWhile() Method This method is included in Stream interface and used to collect the elements into a stream. It takes all […]

  • 24 September

    Java 9 – Process API Improvements

    Table of ContentsThe Process ClassStart a new Process?MethodsExample to get Process IdExample to get Process InformationProcessHandle InterfaceMethodsExampleProcessHandle.Info Interface MethodsWas this post helpful? In this post, we will see about Java 9 process API improvements. Java improved its Process API in Java 9 version that includes new methods for Process class and two new interfaces ProcessHandle […]

  • 19 September

    Java try with resources

    Table of ContentsOlder approach to close the resourcesJava 7 try with resourcesSyntaxExampleJava 9 Try with resources ImprovementsFinally block with try with resourcesCreate Custom AutoCloseable CodeWas this post helpful? In this post, we will see about Java try with resources Statement. Java try with resources is a feature of Java which was added into Java 7. […]

  • 19 September

    Java 9 – @SafeVarargs Annotation

    Table of [email protected] [email protected] with Final [email protected] with Static MethodJava 9 @SafeVarargs ImprovementWithout @SafeVarargs annotationWas this post helpful? In this post, we will see about @SafeVarargs Annotation in Java 9. The @SafeVarargs is an annotation that is used to perform safe operations. When a method takes variable arguments, then it may cause to unsafe operation, […]

  • 19 September

    Java 9 – Anonymous Inner classes and Diamond Operator

    Table of ContentsAnonymous class: Java 9 ImprovementExample: Anonymous class with diamond operatorWas this post helpful? Type inference is a feature of Java that was introduced in Java 7. Now, Java compiler can infer type of a data automatically. For example, if we create an ArrayList then we use the code like: [crayon-62b8715428dd2770867808/] You can see […]

Leave a Reply

Your email address will not be published.

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.