Wednesday, December 29, 2010

How to set ${user} property in Eclipse?

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

${user} uses the value of the environment variable. You can check it via System.getProperty("").

There are several solutions:
  • define it via command line:
    C:/eclipse/eclipse.exe -vmargs"someUserName"
  • define it via eclipse.ini: