Friday, June 5, 2009

Setting User Name in Eclipse For Comments Generation

Recently I have noticed that eclipse IDE on Fedora inserts the default system user name "root" in the @author attribute for java comments.


I have found two ways to change the Default System User name to what ever you like,

The First way is to

The other one is just by  changing the associated templates in Window -> Preferences -> Java -> Editor -> Templates -> @author , and hard coding the author's name.

The Other way is by editing the eclipse.ini file,


For example , the following eclipse.ini file shows what I have done to set my name

-showsplash
org.eclipse.platform
-framework
plugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-Duser.name="Siddhartha(Sidd)"



Notice the  attribute Duser.name , that I have set to Siddhartha(Sidd),  after changing eclipse.ini we should restart eclipse so that changes can take effect.

Now, when ever I want to add comments , against the @author attribute eclipse inserts  Siddhartha(Sidd).



It seems there are basically two ways to set the correct author name (opposed to the system user name Eclipse is using per default) in Eclipse as it appears for example within the autogenerated javadoc comments.
First using -vmargs settings:
eclipse -clean -showlocation -vmargs -Xms512m -Xmx900m -XX:PermSize=128m -XX:MaxPermSize=128m -Duser.name="Your full name"
The other one is just by  changing the associated templates in Window -> Preferences -> Java -> Editor -> Templates -> @author , hardcoding the author's name.

No comments :

Post a Comment