RAS
RAS

Reputation: 8156

How can I change @author tag configuration in eclipse in such a way that it takes the name I have specified?

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

Answers (4)

bdogru
bdogru

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

Perception
Perception

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:

Eclipse Preferences - Java Code Templates

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:

Eclipse Preferences - Java Code Templates - Methods

Click 'Ok' out of all the dialogs to complete and save.

Upvotes: 65

Smit
Smit

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. enter image description here

Upvotes: 13

Hoàng Long
Hoàng Long

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

Related Questions