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:
Let us see an example:
/**
* 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;
……
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.
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.