How do I change the Javadocs template generated in Eclipse?

58,267

Solution 1

Check Preferences / Java / Code Style / Code Template

Section Comment / Type

You can replace the author tag by whatever value you need and it will have an effect on new generated classes.

Code Templates


However, if the template is fine, but the value referenced buy the author tag is not, see this SO question:

${user} uses the value of the user.name environment variable; therefore, you can pass -Duser.name=My Name in eclipse.ini to override it.

Or, if you prefer, you can modify the shortcut to point to:

C:/java/eclipse/eclipse.exe -vmargs -Duser.name="cleverUserNameToUseInSourceCode"

  • MacOs: Aram Kocharyan mentions the eclipse.ini is in Eclipse.app/Contents/MacOS/ if you right click and go Show Package Content.
  • ZendStudio: rofflox comments the file is named ZendStudio.ini and is found in Applications/Zend Studio.app/Contents/MacOS/.

Solution 2

Look at Window -> Preferences -> Java -> Editor -> Templates.

Solution 3

To use a Git username and email you can use the variables ${name:git_config(user.name)} and ${email:git_config(user.email)}.

enter image description here

Solution 4

Spring Tool Suite (popular Eclipse customization for Spring development) uses STS.ini. On Windows I found it in the same dir as an app launch executable.

Solution 5

You should consider using JAutodoc, which is a very useful plugin for Eclipse. The parametrization is way more advanced than the standard Eclipse generation.

Share:
58,267
Olaseni
Author by

Olaseni

I'm Olaseni. Full Stack Developer, DevOps Enthusiast. Loves to read.

Updated on April 19, 2020

Comments

  • Olaseni
    Olaseni about 4 years

    I dislike the default Javadocs generated for me when I create a Class or methods, especially the @author variable, which is the current system username on my windows box.

    I would like to change it. Is this possible?

  • Olaseni
    Olaseni about 14 years
    Yeah I know about that, but unfortunately this does not seem to have any effect on the code generation for Classes. I want to avoid having to do this manually
  • Bahadır Yıldırım
    Bahadır Yıldırım about 14 years
    Unrelated: How did you generate such a pretty screenshot?
  • VonC
    VonC about 14 years
    @Paul: after that meme revealed itself as "mandatory" (meta.stackexchange.com/questions/19478/the-many-memes-of-me‌​ta/…), I had to use FSCapture (faststone.org/FSCaptureDetail.htm) to comply ;)
  • Joseph Lust
    Joseph Lust over 12 years
    Snipping Tool does the trick on Win7. Thanks for the screenshot. This is just what I needed tonight! :)
  • Aram Kocharyan
    Aram Kocharyan almost 12 years
    For Mac users, eclipse.ini is in Eclipse.app/Contents/MacOS/ if you right click and go Show Package Contents
  • Roman
    Roman almost 11 years
    The same goes for Zend Studio for Mac. The ZendStudio.ini is found in Applications/Zend Studio.app/Contents/MacOS/.
  • Ramsharan
    Ramsharan almost 11 years
    Although this is not the answer what I want, this helps to get to the answer. I need to start each file with commented copyright and that can be done by editing Files instead of Types.
  • Kent Bull
    Kent Bull over 9 years
    For STS on Mac OS see VonC's answer while searching through the STS application package.
  • Steffen
    Steffen over 9 years
    Is there a way to replace the eclipse javadoc generation of eclipse with JAutoDoc? What I mean is: I have installing the JAutoDoc plugin. If I now generate get/setter methods via Shft+Alt+S and selecting "Generate Getters and Setters..." the javadoc comments are still generated by eclipse. But I want to generate this comments by JAutoDoc automatically...
  • timbru31
    timbru31 over 7 years
    This is located under Preferences / Java / Code Style / Code Templates / Comments / Types
  • Michael Fulton
    Michael Fulton about 7 years
    eclipse.ini has moved to Eclipse.app/Contents/Eclipse
  • VonC
    VonC about 7 years
    @MichaelFulton Do you mean on Mac? Strange, because wiki.eclipse.org/Eclipse.ini still indicated /MacOS/
  • Michael Fulton
    Michael Fulton about 7 years
    @VonC Hm. This is just where it was for me. I installed Neon.3 using the installer and looked for Eclipse.ini moments later.