Setting the order of import statements

  1. From the menu bar, select Window > Preferences.
  2. In the left pane, expand the Java > Code Style category and select Organize Imports.
  3. The Organize Imports page defines the sorting order of import statements. In the Imports list, manage the list of package prefixes as follows:
  4. In the Number of imports needed before .* field, type the number of import statements that are allowed to refer to the same package before <package prefix>.* is used. This number is called the import threshold.
  5. Click OK when you are done.

Note: The order of import statements can also be configured per project:

  1. Select a java project, open the pop-up menu and choose Properties.
  2. Select the Code Style > Organize Imports page and check Enable project specific sttings.
  3. Manage the list as explained above.
  4. Click OK when you are done.

Related concepts

Java editor

Related tasks

Adding required import statements
Managing import statements
Organizing existing import statements

Related reference

Refactoring actions
Organize Import preference page