Fixing Spaces and Tabs in Eclipse
Fixing spaces and tabs in Eclipse to be compatible with vi, Emacs, and all other 8-spaces-mean-one-tab editors and text utilities in the known universe.
Window --> Preferences --> Java --> Code Style --> Formatter.
In the "Select a profile:" drop-down, "Eclipse [built-in]" is probably selected. That's fine. Beside that drop-down is an "Edit..." button. Click that. An "Edit Profile 'Eclipse [built-in]'" dialogue box comes up.
On the "Indentation" tab (pardon the pun) at the top are "Tab policy", "Indentation size", and "Tab size"; change these to
Tab policy: Mixed Indentation size: 4 Tab size: 8
You will be prompted to rename the profile. Choose a name like "8-space tab compatible"
Click "Apply" the "OK" and when you are returned to the "Formatter" section of the "Preferences" dialogue, ensure that you now have your new profile, "8-space tab compatible" selected. Press "Apply" and then "OK".