javadoc_holamundoswing

How to generate documentation for Java programs automatically: Javadoc

All programmers know that the code has to be commented. The better way is to comment the code in the same file. There are others ways but not as useful as the first one.

In Java, the programmers use to write comments in the code and with a tool called Javadoc, the comments can be extracted and incorporated in web pages with HTML format.

The comments have to be inserted between the characters /** and */ .

Besides the comment, you can include others more specific labels like these:

  • @author. Identifies the author of the source code.
  • @version. Identifies the versión of the code.
  • @return. Specifies the return value of the function or method. If it is void there is no need to be registered.
  • @since. This label specifies the creation date.
  • @deprecated. Specifies that this item is deprecated.
  • @param <param_name>. Describes the parameter “param_name”. Each parameter in an independent line.
  • @see. Use this label if you want to forward the reader to other place of the document.
  • @link <URL>. Use this label if you want to forward the reader to an URL.
  • Let us see an example:

    package holamundoswing;

    /**
    * clase holamundoswing
    * @author Juan Carlos
    * @version 1.0
    * @since 06/06/2015
    *
    *

    This class is an example of hello world with swing.

    */

    //We have to import all the components of our app
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    ……

    Remember….
    To generate the former documentation of the class, you will have to execute from the command line:
    javadoc holamundoswing.java

    After executing javadoc (remember that you can execute javadoc in NetBeans or Eclipse also) from the command line, you will get several web pages with the documentation of your program.

    javadoc_holamundoswing

    JavaHelp as a tool to generate the help system of your program. .

    A lot of times, a help menu is required by the user. This help system has to be embedded in the program itself. JavaHelp is a Java extension that can help you to implement it.

    JavaHelp will generate several windows based in XML and HTML files, perfect to help the user to manage the software.

    Deja un comentario

    Tu dirección de correo electrónico no será publicada. Los campos necesarios están marcados *

    Puedes usar las siguientes etiquetas y atributos HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>