How do I set ${user} in Eclipse to get the correct @author tag?

Eclipse

Eclipse Problem Overview


> Possible Duplicate:
> How to change the value of ${user} variable used in Eclipse templates

I am using Eclipse and every time code is created, @author is set to the value of ${user}. Unfortunately,${user} seems to contain my windows login id. Is there a way to override this through Eclipse? I couldn't find the option.

Eclipse Solutions


Solution 1 - Eclipse

I'm not sure if there's a way in Eclipse itself. But from what I can find, ${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"

as shown in this blog entry.

@author ${user}

Solution 2 - Eclipse

Windows > Preferences > Java > Code Style > Code Templates > Comments

Select Types and edit the template to insert another value (possibly a fixed one for now, or change the user.name property as mmyers suggests)

/**
 * @author myUserValue
 *
 * ${tags}
 */

Code Template preferences

Attributions

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
QuestionUriView Question on Stackoverflow
Solution 1 - EclipseMichael MyersView Answer on Stackoverflow
Solution 2 - EclipseVonCView Answer on Stackoverflow