Eclipse goodie: your actual name instead of login in JavaDoc author tags

Of course, this small tip is common knowledge amongst all developers that use Eclipse as their IDE, but I only recently came across it.

Eclipse doesn’t know your real name, and it doesn’t provide a way to configure it in the settings panels. The default behavior of Eclipse when inserting JavaDoc comments in your code is to use the system property user.name. This generates code like:

/**
 * @author dashorst
 */

or when working with Eclipse at home:

/**
 * @author martijn
 */

Instead I want it to generate a comment like:

/**
 * @author Martijn Dashorst
 */

Currently I have to go to the author tag and retype the generated name. Now that is not cool. And what I also don’t want to do is to change the templates that are provided by Eclipse. So, instead: I altered the eclipse.ini file, which you probably already have changed to increase the available memory and have these values:

-vmargs
-Xms128m
-Xmx512m
-Duser.name=Martijn Dashorst

The last parameter is the one that this tip concerns.

Define the user.name system property at startup of Eclipse and presto! The name of your choosing will always be correct!

7 Responses to “Eclipse goodie: your actual name instead of login in JavaDoc author tags”

  1. Anonymous says:

    Wow! Thanks. Good tip. To overcome this I have edited the code template and replaced @author ${user} with hard coded name. Now I can revert this.

    Joni

  2. Anatol Pomozov says:

    Hi guys. What you really need is Intellij IDEA :)

    Joking.

  3. I have IntelliJ IDEA, but I find it hard to get working in it. I just don’t find the time to properly get used to it unfortunately.

    I definetely think the whole package of IDEA is a better deal, but my investment in using Eclipse is very high.

  4. Anonymous says:

    > Define the user.name system property at startup of Eclipse and
    > presto! The name of your choosing will always be correct!

    Have any plugin that relies on user.name being your username, and presto! It will break.
    :)

  5. Martin says:

    > Have any plugin that relies on user.name being your username, and
    > presto! It will break.

    Is that true? Can you name any plugins for which this is known?

    Thanks

  6. Sumin says:

    Thanks a lot! I’m a Mac user so I had to edit eclipse.ini within the Eclipse.app package. Good thing is that the Eclipse.app package is not code signed ;-)

  7. sergio says:

    @Sumin:

    Thanks, Mac user here. That helped a lot.

    It’s dumb that eclipse doesn’t offer a simple option in the IDE to set the javadoc user name, though.

Leave a Reply