Managing Java Import Statements

You can add import statements for Java classes in any of the following ways:

Fix Imports and Fast Import Commands

The rest of this topic details the differences between the Fix Imports and the Fast Import command.

The Fix Imports command:

The Fast Import command enables you to choose how you want the import handled in your code. You can:

To add a single import statement:

  1. In the Source Editor, move the insertion point to the name of the class that needs to be imported.
  2. Press Alt-Shift-I.

    If the class is found, the Import Class dialog box is displayed. This contains a list of classes that match the class at the insertion point.

    For example, if the class name is List, the dialog box displays java.awt.List, java.util.List, and any other class that you have defined with the name List.

  3. Select the class that you want to import.
  4. Select the radio button that corresponds to the way that you want the class to be imported.
  5. Click Import.

    The IDE generates the import statement in your Java source file.

To add all missing import statements:


Legal Notices