I always have this done in Eclipse as a Save Action. In the Preferences menu you go to Java -> Editor -> Save Actions and there you can add 'Remove trailing white space on all lines' in the 'Additional Actions' section to get them removed automatically whenever you save a Java file...