Shift + Alt + J will help you add author name in existing file.
To add author name automatically,
go to Preferences --> java --> Code Style --> Code Templates
in case you don't find above option in new versions of Eclipse - install it from https://marketplace.eclipse.org/content/jautodoc
You can control select all customised classes and methods, and right-click, choose "Source", then select "Generate Element Comment". You should get what you want.
If you want to modify the Code Template then you can go to Preferences -- Java -- Code Style -- Code Templates, then do whatever you want.
To old files I don't know how to do it... I think you will need a script to go thru all files and add the header.
To change the new ones you can do this.
Go to Eclipse menu bar
/**
${user}
*/
And it's done every new File will have your name on it !
Quick and in some cases error-prone solution:
Find Regexp: (?sm)(.*?)([^\n]*\b(class|interface|enum)\b.*)
Replace: $1/**\n * \n * @author <a href="mailto:[email protected]">John Smith</a>\n */\n$2
This will add the header to the first encountered class/interface/enum in the file. Class should have no existing header yet.
Source: Stackoverflow.com