"; */ ?>

Changing Tabs to Spaces in Eclipse

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”

p

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

show/edit profile window

and change the “Tab Policy” from “Tabs only” to “Spaces only”

3. Click “Ok”, choose the name for this profile and save it

save profile window

 

You are all set and ready for “indentational independence” 😉