How do I change the Javadocs template generated in Eclipse?


Java Problem Overview

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?

Java Solutions

Solution 1 - Java

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 environment variable; therefore, you can pass 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"cleverUserNameToUseInSourceCode"

  • MacOs: Aram Kocharyan mentions the eclipse.ini is in if you right click and go Show Package Content.

  • ZendStudio: rofflox comments the file is named ZendStudio.ini and is found in Applications/Zend

Solution 2 - Java

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

Solution 3 - Java

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 4 - Java

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

enter image description here

Solution 5 - Java

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


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionOlaseniView Question on Stackoverflow
Solution 1 - JavaVonCView Answer on Stackoverflow
Solution 2 - JavaBinil ThomasView Answer on Stackoverflow
Solution 3 - JavaAlexey SlepovView Answer on Stackoverflow
Solution 4 - JavachrisjleuView Answer on Stackoverflow
Solution 5 - JavaJulienView Answer on Stackoverflow