i know that we can create documentation from java source files. but how to do it?. thanks in advance.
Gowth, reade the javadoc docs:
javadoc - The Java API Documentation Generator
Generates HTML pages of API documentation from Java source files. This document contains JavadocTM examples for Microsoft Windows.
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html
The javadoc
command is used to turn Javadoc-style comments into HTML pages. Sun also provides a tutorial on how to write doc comments for the Javadoc tool.
There are also other tools, such as Doxygen, that perform similar tasks.
It pretty much boils down to this: specially formatted comments and an application called javadoc
. Note that you will need a Java Development Kit (JDK) installed; JRE won't suffice.
Say you want to generate Javadoc for a function setScheduling()
. You would format the code as follows:
/**
* Internal function that signals the current thread to be in a scheduling
* state. In this state, it cannot be interrupted.
*
* @param scheduling
*/
private void setScheduling(boolean scheduling) {
this.scheduling = scheduling;
}
Note the two stars to begin the comment, indicating it is JavaDoc: /**
I highly recommend developing Java in an established IDE such as Eclipse or NetBeans. It will make generating JavaDocs as easy as hitting Project, Generate Javadoc.
As a standalone tool(apart from IDE support) you can look at Java2HTML, quite simple and straightforward for operating outside the IDE.