score:309

Accepted answer

it seems that your best bet is to redefine the java user.name variable either at your command line, or using the eclipse.ini file in your eclipse install root directory.

this seems to work fine for me:

-showsplash
org.eclipse.platform
--launcher.xxmaxpermsize
256m
-vmargs
-dosgi.requiredjavaversion=1.5
-duser.name=davide inglima
-xms40m
-xmx512m    

update:

http://morlhon.net/blog/2005/09/07/eclipse-username/ is a dead link...

here's a new one: https://web.archive.org/web/20111225025454/http://morlhon.net:80/blog/2005/09/07/eclipse-username/

score:-4

just other option. goto preferences >> java >> editor >> templates, select @author and change the variable ${user}.

score:-1

window -> preferences -> java -> code style -> code templates -> comments -> types chnage the tage infront ${user} to your name.

before

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

after

/**
 * @author waqas ahmed
 *
 * ${tags}
 */

enter image description here

score:0

edit the file /etc/eclipse.ini, so as to contain entry as;

-duser.name=myname

restart the "eclipse" and now, on creation of any new file, with wizard (c/c++/java), it will use "myname" in place of ${user}.

score:1

this is the file we're all looking for (inside your eclipse workspace):

.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs

you will find an @author tag with the name you want to change. restart eclipse and it will work.

for accents you have to use the unicode format (e.g. '\u00e1' for á).

you can also modify the 'ini' file as prior answers suggest or set the user name var for a global solution. or override the @author tag in the preferences menu for a local solution. those are both valid solutions to this problem.

but if you're looking for 'that' author name that is bothering most of us, is in that file.

score:3

dovescrywolf gave tip as a comment on article linked by davide inglima

it was was very useful for me on macos.

  • close eclipse if it's opened.
  • open termnal (bash console) and do below things:

    $ pwd /users/you/youreclipseinstalationdirectory  
    $ cd eclipse.app/contents/macos/  
    $ echo "-duser.name=your name" >> eclipse.ini  
    $ cat eclipse.ini
    
  • close terminal and start/open eclipse again.

score:16

rather than changing ${user} in eclipse, it is advisable to introduce

-duser.name=whateverpleaseyou

in eclipse.ini which is present in your eclipse folder.

score:20

egit solution

one would expect creating or changing template variables on a project-, workspace-, or environment-basis is a standard eclipse feature. sadly, it is not. more so, given that eclipse plugins can define new variables and templates, there should be plugins out there providing a solution. if they are, they must be hard to find. mmm-templatevariable, which is available in the eclipse marketplace, is a step in the right direction for maven users, giving the ability to include version, artifactid, etc. in templates.

fortunately, egit, which is an eclipse tool for git, provides very flexible means for including many different variables in code templates. the only requirement is that your project uses git. if you don’t use git, but are serious about software development, now is the time to learn (pro git book). if you are forced to use a legacy version control system, try changing some minds.

thanks to the efforts of harmsk, egit 4.0 and above includes the ability to use git configuration key values in templates. this allows setting template values based on repository settings (project), user settings (account), and/or global settings (workstation).

the following example shows how to set up eclipse and git for a multi-user development workstation and use a custom git configuration key in lieu of ${user} to provide more flexibility. although the example is based on a windows 10 installation of eclipse mars and git for windows, the example is applicable to linux and osx running eclipse and git using their respective command line tools.

to avoid possible confusion between git’s user.name configuration key and java’s user.name system property, a custom git configuration key – user.author – will be used to provide an author’s name and/or credentials.

configuring templates

the format of a git template variable is as follows

${<name>:git_config(<key>)}

where <name> is any arbitrary variable name and <key> is the git configuration key whose value should be used. given that, changing the comments→types template to

/**
 * @author ${author:git_config(user.author)}
 *
 * ${tags}
 */

will now attempt to resolve the author’s name from git’s user.author configuration key. without any further configuration, any newly created comments will not include a name after @author, since none has been defined yet.

configuring git

from the command line

git system configuration - this configuration step makes changes to git’s system-wide configuration applicable to all accounts on the workstation unless overridden by user or repository settings. because system-wide configurations are part the underlying git application (e.g. git for windows), changes will require administrator privileges. run git bash, cmd, or powershell as administrator. the following command will set the system-wide author.

git config --system user.author “set me in global(user) or repository(local) settings”

the purpose of this “author” is to serve as a reminder that it should be set elsewhere. this is particularly useful when new user accounts are being used on the workstation.

to verify this setting, create an empty java project that uses git or open an existing git-based project. create a class and use source→generate element comment from the context menu, alt-shift-j, or start a javadoc comment. the resulting @author tag should be followed by the warning.

the remaining configuration changes can be performed without administrator privileges.

git global(user) configuration - global, or user, configurations are those associated with a specific user and will override system-wide configurations. these settings apply to all git-based projects unless overridden by repository settings. if the author name is different due to various project types such as for work, open source contributions, or personal, set the most frequently used here.

git config --global user.author “mr. john smith”

having configured the global value, return to the test project used early and apply a class comment. the@author tag should now show the global setting.

git repository(local) configuration - lastly, a repository or local configuration can be used to configure an author for a specific project. unlike the previous configurations, a repository configuration must be done from within the repository. using git bash, powershell, etc. navigate into the test project’s repository.

git config --local user.author “smithy”

given this, new comments in the test project will use the locally defined author name. other git-based projects, will still use the global author name.

from within eclipse

the configuration changes above can also be set from within eclipse through its preferences: team→git-configuration. eclipse must be run as administrator to change system-wide git configurations.

in sum

although this example dealt specifically with the most common issue, that of changing ${user}, this approach can be used for more. however, caution should be exercised not to use git-defined configuration keys, unless it is specifically intended.

score:41

windows > preferences > java > code style > code templates > comments

enter image description here

or open eclipse.ini file and add following.

-duser.name=sumit singh // your name

enter image description here

score:105

open eclipse, navigate to window -> preferences -> java -> code style -> code templates -> comments -> types and then press the 'edit' button. there you can change your name in the generated comment from @author ${user} to @author rajish.


Related Query

More Query from same tag