Trying to understand JavaDoc and custom Doclets

Posted on 2006-04-19
Last Modified: 2006-11-18
Hi I've been trying to understand how JavaDocs and Custom doclets work. I want to create a doclet that will only display methods which has a custom tag, i.e. if a method has @myTag in the comments it'll display all the comments for that method whereas if it doesn't have @myTag it doesn't show any oof the comments

I created a custom taglet and specify the following command in Eclipse:
           -taglet DocPackage.myTag -tagletpath 'C:\\Documents and Settings\\bbermingham\\workspace\\JavaDocTest'

But I want it to output in the standard html format. I think I'll have to completly create a new Doclet which has all the code for creating the html files, css files, etc because the Standard doc really can't be modified (I found). I'm very new to this and really I'm just looking for steps to create this custom doclet. What classes do I need to refer to, do I need to implement another class or extend from Doclet or Standard?

I hope I'm making sense.
Question by:rebels_mascot
    LVL 11

    Accepted Solution

    Here you can find some info:

    And here is a part from it:
    Example - Subclassing the Standard Doclet
    To customize the output of the Javadoc tool, you need to write your own doclet that specifies the content and format of the output that you desire. If you want HTML output with roughly the same format as the default output, you can use the standard doclet as a starting point for creating your doclet. You can subclass appropriate classes in the standard doclet and then add or override methods as necessary to produce the output you want. Or you can copy the whole standard doclet and modify it. If you use a copy of the standard doclet as your starting point, you may want to remove the package statements at the beginning of each source file and replace them with the name of your own, new package.

    Author Comment

    Thanks for the quick reply WelkinMaze, I've come across that before but not sure how to change the methods they refer to. The file is as follows:

     * @(#)      1.4 04/07/26
     * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
     * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.


    import com.sun.javadoc.*;

    public class Standard {
        public static final HtmlDoclet htmlDoclet = new HtmlDoclet();
        public static int optionLength(String option) {
            return htmlDoclet.optionLength(option);
        public static boolean start(RootDoc root) {
            return htmlDoclet.start(root);
        public static boolean validOptions(String[][] options,
                                       DocErrorReporter reporter) {
            return htmlDoclet.validOptions(options, reporter);

        public static LanguageVersion languageVersion() {
          return htmlDoclet.languageVersion();

    I can't see how I can change this to only output methods with the @myTag taglet.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    This video teaches viewers about errors in exception handling.
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now