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.
Simply go to: Window - Preferences - Java - Code Style - Code Templates - Comments - Types - Edit... and change ${user} to whatever you want. Also go to: Window - Preferences - Java - Editor - Templates - @author - Edit... and change ${user} to whatever you want.
Shift + Alt + J will help you add author name in existing file.
Go to Tools -> Templates. Click on Settings button. A new panel with template settings will appear in your IDE: Uncomment the last line and change the value of "user" to what ever you like to be inserted after the @author tag.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With