How can I generate Javadoc comments in Eclipse? [duplicate]

Is there a way to generate Javadoc comments in Eclipse? If so, what is it?


Solution 1:

For me the /**<NEWLINE> or Shift-Alt-J (or --J on a Mac) approach works best.

I dislike seeing Javadoc comments in source code that have been auto-generated and have not been updated with real content. As far as I am concerned, such javadocs are nothing more than a waste of screen space.

IMO, it is much much better to generate the Javadoc comment skeletons one by one as you are about to fill in the details.

Solution 2:

Shift-Alt-J is a useful keyboard shortcut in Eclipse for creating Javadoc comment templates.

Invoking the shortcut on a class, method or field declaration will create a Javadoc template:

public int doAction(int i) {
    return i;
}

Pressing Shift-Alt-J on the method declaration gives:

/**
 * @param i
 * @return
 */
public int doAction(int i) {
    return i;
}

Solution 3:

JAutoDoc:

an Eclipse Plugin for automatically adding Javadoc and file headers to your source code. It optionally generates initial comments from element name by using Velocity templates for Javadoc and file headers...

Solution 4:

You mean menu Project -> Generate Javadoc ?

Solution 5:

At a place where you want javadoc, type in /**<NEWLINE> and it will create the template.