Setting code formatting preferences

  1. Open the Java > Code Style > Formatter preference page.
  2. Select a profile and click the Show or Edit button to configure it, or press New to create a new profile.
  3. In the dialog, select the code formatting conventions that you want the formatter to follow.
  4. Note that at the right side of the page, you can observe an example effect of each individual code formatting option and see a preview of what your formatted code will look like.
  5. Click OK when you are done.

Note: Code formatter settings can also be configured per project:

  1. Select a java project, open the pop-up menu and choose Properties.
  2. Select the Code Style > Formatter page and check Enable project specific settings.
  3. Select or edit a profile as explained above.
  4. Click OK when you are done.

Related concepts

Java development tools (JDT)

Related tasks

Formatting Java code
Formatting files or portions of code
Using the Formatter Application

Related reference

Code Formatter preferences