Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Java Development User Guide
Previous Page Home Next Page

Organizing import statements

In this section you will organize the import declarations in your source code.  Open junit.samples/ file in the Java editor if you do not already have it open.

  1. Delete the import declarations by selecting them in the Outline view and selecting Delete from the context menu. Confirm the resulting dialog with Yes. You will see numerous compiler warnings in the vertical ruler since the types used in the method are no longer imported.

    Outline view context menu

  2. From the context menu in the editor, select Source > Organize Imports. The required import statements are added to the beginning of your code below the package declaration.

    Organize imports

    You can also choose Organize Imports from the context menu of the import declarations in the Outline view.
    Note: You can specify the order of the import declarations using the Goto the organize imports preference page Java > Code Style > Organize Imports preference page.
  3. Save the file.

Related concepts

Java editor

Related reference

Organize Imports Preferences

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire