Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

eclipse

People also ask

How do I change the author tag in eclipse?

Simply go to: Window - Preferences - Java - Code Style - Code Templates - Comments - Types - Edit... and change ${user} to whatever you want. Also go to: Window - Preferences - Java - Editor - Templates - @author - Edit... and change ${user} to whatever you want.

How do I find the author name in Eclipse?

Shift + Alt + J will help you add author name in existing file.

Where can I find Eclipse INI file?

For windows, it's in the same directory as eclipse.exe file, as shown in below image. You can reach this location by first right clicking on Eclipse app and click on “Show Package Contents” and then in the next window navigate to Contents/Eclipse directory, as shown in below images.


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}


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