Let’s say you are developing a high performance code using Eclipse on Windows, than you deploy it to Unix Server, which FTPs some of the code to IBM’s z/OS… Let’s just say you do
It is obvious that these different operating systems use different editors and might even use (z/OS – EBCDIC) different character encodings… That is where incorrect formatting/indentation can decrease readability and maintainability tremendously…
Here is one quick tip on how to ensure that indentation stays the same across all the systems/editors:
use spaces instead of tabs
Here is how to change the default Eclipse “tabbing behavior” to the unified “spacing” one. Some people refer to it as changing “Hard TABs to soft TABs”:
1. Open the default workspace in Eclipse (open Eclispse
) and go to “Window -> Preferences -> Java -> Code Style -> Formatter”

2. Click on “Show” button (if you previously edited this profile the button caption will be “Edit”)

and change the “Tab Policy” from “Tabs only” to “Spaces only”
3. Click “Ok”, choose the name for this profile and save it

You are all set and ready for “indentational independence”
Sweet – I was off and running in no time!
thanks for the tip, tabs for indentation is some mistake, hopefully can be fixed
When you select a block of lines and hit tab to indent the block, Eclipse ignores the ‘spaces only’ setting and inserts tab characters. This is a bug.
No, don’t change to spaces just because some editors are broken.
Works perfect! Thanks!
GameRendering: Instead be dependent on everybody on your project using the same editor with same tab indentation?
No thank you, I’ll much rather have source code that is editor independent and works right anywhere.
When doing this, how do you get backspace to delete multiple spaces at once?
thank you! Super helpful.
thank you it worked……
thanks a lot this helped me to remove check style errors
Thanks this is exactly what I was looking for. Is there a way just to convert spaces to tabs?
j4y, you can use Andrey Loskutov’s AnyEdit plugin from http://andrei.gmxhome.de/anyedit/.
This Eclipse plugin adds commands to change spaces to tabs and vice vera on the fly in any editor or across a whole selection of files.
Thanks! I have two Java classes this term at my university and this is a requirement. Your guide is very easy to follow. Keep up the good work!
Its remove all the tabs .Good explanation .thanks a lot .