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!

8 thoughts on “Eclipse goodie: your actual name instead of login in JavaDoc author tags

  1. 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. 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.

  3. > 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.
    :)

  4. > 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

  5. 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 ;-)

  6. @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.

  7. Almost two years in and this is still an issue in Eclipse 3.7. Sad! But anyway thanks alot for figuring this out.
    The linux location for this depends on where you installed eclipse. I have eclipse.ini files at these locations:
    /etc/eclipse.ini
    /opt/Eclipse3.6/eclipse.ini
    /opt/Eclipse3.7/eclipse.ini
    /usr/lib/eclipse/eclipse.ini

    A simple # locate eclipse.ini should do it if your locate_db is up to date.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>