How to change the value of ${user} variable used in Eclipse templates

前端 未结 10 2135
遇见更好的自我
遇见更好的自我 2020-12-02 03:58

Instead of hardcoding the default @author template I would like Eclipse to use user\'s real name taken from account information (in Linux - but Windows solution is also welc

相关标签:
10条回答
  • 2020-12-02 04:35

    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.

    0 讨论(0)
  • 2020-12-02 04:43
    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

    0 讨论(0)
  • 2020-12-02 04:47

    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}.

    0 讨论(0)
  • 2020-12-02 04:48

    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.

    0 讨论(0)
提交回复
热议问题