Netbeans: Headers to Java File

In the Netbeans IDE, whenever you create a project/file, it adds the following header.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

Here we will see, how to change or customize this header to suit our needs.

  • Select Tools -> Templates -> Template Manager
  • Change the License statement
    • Select: Licenses -> Default License
    • Click the “Open in Editor” Button, Remove the existing text and add the following lines:

<#if licenseFirst??>
${licenseFirst}
</#if>
${licensePrefix} (c) ${date?date?string(“yyyy”)} Your/ Company Name
<#if licenseLast??>
${licenseLast}
</#if>

  • Save
  • Change the Program Header
    • Java -> Java Main class
    • Click the “Open in Editor” Button
    • Replace the following lines:

 /**
* @author ${user}
*/

  • With this lines:

/**
* File Name:    ${nameAndExt}
* Project Name: ${project.name}
*
* @since  ${date}, ${time}
* @author ${user}
*
* File Description:
* Provide a 2 line short description.
**/

  • Save
  • Repeats the previous step, for the following templates also:
    • Java Class
    • Java Interface
    • Java Singleton Class
    • Java Exception
  • Set Proper User Name: In Template Manager, Click the “Settings” Button and add the following line:

   user=Your Full Name <Your_Mail_Id@domain.com>

Advertisements
Tagged with: ,
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: