CIT 594 Eclipse Settings
Spring 2009, David Matuszek

Required settings:

Formatting according to Eclipse's Java Conventions [built-in] is mostly correct, but there is one problem: it indents using both tabs and spaces, which means that your formatting will look seriously messed up if someone views your program with different tab settings. Tabs should never occur in a Java file.

Fix this as follows:

  1. Go to Eclipse -> Preferences... (or Window -> Preferences... in some versions)
  2. Open Java -> Code Style -> Formatter
  3. Choose Java Conventions [built-in] as the "Active Profile", and click Edit...
  4. In the "Indentation" tab, set "Tab policy:" to "Spaces only", and set both "Indentation size:" and "Tab size:" to 4
  5. At the top, enter a new "Profile name:", for example, Java Conventions [corrected]
  6. Hit Apply and OK until you are out of the Preferences dialog

Also,

  1. Go to Eclipse -> Preferences... (or Window -> Preferences... in some versions)
  2. Open General -> Editors -> Text Editors
  3. Set the "Displayed tab width:" to 4 and check "Insert spaces for tabs"
  4. Hit Apply and OK until you are out of the Preferences dialog

This matters because good indentation matters!

Finally,

Recommended settings:

In Preferences,

Eclipse is highly configurable. If there is something it does that you don't like (or something that it doesn't do that you wish it would), spend some time looking through the preferences--it's probably already there somewhere!