X

Geertjan's Blog

  • October 25, 2006

Changing "@author" for New Java Files

Geertjan Wielenga
Product Manager
During the NetBeans User Group meeting in Munich recently, one of the participants asked me "how to change the author value in a Java file". By default, the computer's user name is used. But, imagine you changed your name (or, more likely, you've inherited someone else's computer), and you still get your old name in a Java file whenever you create it:

/\*\*
\*
\* @author Geertjan Wielenga
\*/
public class NewClass {
/\*\* Creates a new instance of NewClass \*/
public NewClass() {
}
}

This is where you'd go to change the setting that determines what ends up generated in a new Java file:

And now, next time you create a Java file, your new name will appear:

/\*\*
\*
\* @author Santa Claus
\*/
public class NewClass1 {
/\*\* Creates a new instance of NewClass1 \*/
public NewClass1() {
}
}

The dialog box above is found under the Tools menu. There, select Options and then, in the Options window, click Advanced Options.

Join the discussion

Comments ( 1 )
  • Rohan Ranade Wednesday, October 25, 2006
    1. You can add your own "replacement strings" there eg. FOOBAR=Sample Text and then create a new template using the template manager:
    /\*\*
    \*
    \* @author __USER__
    \* __FOOBAR__
    \*/
    public class Class {
    /\*\* Creates a new instance of __NAME__ \*/
    public Class() {
    }
    }
    __FOOBAR__ will be replaced!
    2. Our team had hit a minor issue regarding netbeans file templates recently. We wanted the DATE format like MM/DD/YY, but default setting will be like "October 16, 2006" (Month DD, YYYY) format. Havent figured out a way to do this (patching the java source module is an option, but would not really prefer it).
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha