Reputation: 8156
I'm using Eclipse Indigo for Java.
I used to write comments over the methods.
In that whenever I use @author
tag, it automatically takes the username of the system who is currently logged in.
My question is : How can I change this @author
tag configuration in such a way that it takes the name I have specified.
I have gone through the following link:
How to change the value of ${user} variable used in Eclipse templates
But it suggests to change the value of classpath variable $user
.
I don't want to do that. I want to change comment template through configuration.
Upvotes: 49
Views: 58889
Reputation: 842
In the eclipse directory there is a file named: "eclipse.ini" open the file and add following line:
-Duser.name=desired name
after the "-vmargs" line
Upvotes: 28
Reputation: 80623
There are several ways of accomplishing this. Open up Eclipse Preferences, type in Templates
as your Filter, then select Java->Code Style->Code Templates
. In the Code Templates widget, expand the Comments widget:
Looking through the expanded selection, you can see that there are templates defined for Types and Methods, amongst others. Select whichever template you want to edit, then click 'Edit'. You can now change the template as you see fit, for example by adding @author ${user}
or whatever else to it:
Click 'Ok' out of all the dialogs to complete and save.
Upvotes: 65
Reputation: 4715
Project->Properties->Java Code Style->Code Template->
There is link Configure workspace setting
Select Comment->Types
Edit your name or whatever you want.
Upvotes: 13
Reputation: 10848
You can go to the Windows/Preference. Type int "Template" in the search box and go to Java/Code Style/Code Templates. The area you are searching is in the "Comments" part.
Upvotes: 1