banner



How To Create Java Documentation In Eclipse

5 Answers 5

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.

answered Nov 22 '09 at 0:23

3

  • To save space, fold it!

    Nov 22 '09 at 1:18

  • @Pascal - I'd prefer to delete it/them, or not generate it/them in the first place. IMO, generated javadoc comments add zero value ... unless you count a bogus boost to the comment-to-code ratio as "value".

    Nov 22 '09 at 2:54

  • important note: If using shift-alt-j, don't forget to place the cursor first in the method you want to document otherwise your comment will be added at the top of the file for the class.

    Oct 13 '16 at 7:38

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; }                              

answered Nov 22 '09 at 0:18

2

  • On a Mac, it's ⌘-alt-J

    Jan 11 '13 at 16:41

  • You just made my life SOOOOO much better! I'll thank you every time I use shift-alt-J -- and every time I look brilliant when I show it to coworkers!

    Aug 29 '14 at 16:37

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...

gnat

6,216 103 gold badges 51 silver badges 72 bronze badges

answered Nov 21 '09 at 23:44

2

  • better than the built in alt-shift-j

    Oct 6 '13 at 2:37

  • And shortcut is Ctrl + Alt + J

    Nov 26 '19 at 6:37

You mean menu Project -> Generate Javadoc ?

answered Nov 21 '09 at 23:51

7

  • That menu item isn't in any of the perspectives I use.

    Nov 21 '09 at 23:53

  • It's on my Eclipse, and the only extra things I've installed are Google Web Toolkit and FindBugs. (This is Ganymede, not Europa. Maybe you need to upgrade?)

    Nov 21 '09 at 23:56

  • I only have the gwt perspective, eclipse v 3.5.1

    Nov 21 '09 at 23:58

  • Maybe you need to install Eclipse for Java Developers or Eclipse for J2EE developers.

    Nov 22 '09 at 0:00

  • Anyway, this is not what the OP is looking for. The question (which is a bit misleading) is not about generating the javadoc but adding javadoc "comments" in the code.

    Nov 22 '09 at 0:35

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

answered Nov 21 '09 at 23:51

3

  • 1. that works, thank. 2. that menu item isn't in any of the perspectives I use.

    Nov 21 '09 at 23:59

  • im interested to know what your perspective is

    Nov 22 '09 at 9:49

  • Generate Javadoc does not generate Javadoc comments. It parses Javadoc comments and generates project documention (usually HTML)

    Jan 3 '12 at 18:37

Not the answer you're looking for? Browse other questions tagged java eclipse javadoc or ask your own question.

How To Create Java Documentation In Eclipse

Source: https://stackoverflow.com/questions/1777175/how-can-i-generate-javadoc-comments-in-eclipse

Posted by: blakeronfiess.blogspot.com

0 Response to "How To Create Java Documentation In Eclipse"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel