views:

129

answers:

4

i know that we can create documentation from java source files. but how to do it?. thanks in advance.

+9  A: 

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

Kamia
+4  A: 

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.

Thomas Owens
+3  A: 

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.

Paul Lammertsma
Any IDE with decent Java support will make generating Javadocs easy. In NetBeans, you can select Run > Generate Javadoc to do the same thing.
Thomas Owens
Yes, you are entirely correct. It wasn't my intention to pick one IDE over another, but I understand it reads that way.
Paul Lammertsma
True. I was just adding how you can generate Javadoc in my IDE of choice. In fact, that's one of the things I look for in a Java IDE - if I can't generate Javadoc, why should I use it?
Thomas Owens
A: 

As a standalone tool(apart from IDE support) you can look at Java2HTML, quite simple and straightforward for operating outside the IDE.

non sequitor