Simply go to: Window - Preferences - Java - Code Style - Code Templates - Comments - Types - Edit... and change ${user} to whatever you want. Also go to: Window - Preferences - Java - Editor - Templates - @author - Edit... and change ${user} to whatever you want.
We first navigate to Preferences -> General -> Copyright. Then, to add a new copyright header, we click on the Add button. To modify an existing license, we select a license from the Licenses and then click on the Modify button.
All program files should have header comments and it should be located at the TOP of the file! The file header comment details what is in a file. Among other things it should have: The author, date, and course number.
You should use /* */ , it seems to be the standard in the majority of open source java projects.
If you are looking for a tool with a good Eclipse integration (and a nice GUI), I suggest: Eclipse Copyright Generator
This adds:
I just tried it with eclipse 3.6 and it work fine.
There is an update site to install it:
https://dl.bintray.com/jmini/Eclipse-Copyright-Generator/
Window > Preferences > Java > Code Style > Code Templates > Comments > Files
In addition to the answer provided by Bozho, there are the releng tools provided by eclipse, which give you some menu item commands to fix copyrights in existing files. You can install the releng tools from this update site:
The Eclipse Project Updates - http://download.eclipse.org/eclipse/updates/4.3
And there is a small bit information available on it here:
https://wiki.eclipse.org/Development_Resources/How_to_Use_Eclipse_Copyright_Tool
In addition to Andrew Eisenberg's reply, here's what I found out about the Eclipse copyright tool. I found this to work best from all suggested solutions.
Pluses:
Minuses:
Customization (from preferences):
You can apply the license at the file or package level
The project that @Jmini link (Eclipse Copyright Generator) seems dead, you can use this plugin to add the headers: JAutoDoc, it's very easy to use and have a lot of utilities for javadoc.
You need to specify a licence in project|general > Preferences > java > JAutodoc > FileHeader
and later in the project use: project > JAutodoc > Add Header
, make sure the option Replace Existing Header
is on.
The template is writing using Velocity, so you can add all the information you need as variables.
this is my setting under Window > Preferencers > Java > Code Style > Code Template > Code > New Java files
:
/*
* Copyright (c) 20XX XXXXXXXXX. All rights reserved. Whatever......
*/
${filecomment}
${package_declaration}
${typecomment}
/**
*
* @author ${user}
*
*/
${type_declaration}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With