How To Auto Import All Java Classes In Eclipse

When you develop java project in eclipse, of course you want to make class import automatically when you type a class name, especially when you copy & paste huge java source code to you java file. This article will tell you how to import java class automatically in eclipse.

1. Auto Import Java Class In Single Java File.

  1. Input the class name in java source file.
  2. Click Source —> Organize Imports menu item or Shift+Ctrl+O, then the java class will be imported in the java source file automatically.
    eclipse source organize imports menu item

2. Auto Import Java Class In All Java Project Files.

If you have a lot of java source file need auto import used java classes, you can config your java project to achieve it.

  1. Click eclipse Project —> Properties menu item.
    eclipse project properties menu item
  2. Then click Java Editor —> Save Actions menu item in left panel. Check related checkbox in right panel. In this case we should check Organize imports checkbox. And then click Apply and Close button to save changes. Now when you click save button to save a java source file, all the referenced java classes in this java file will be imported automatically.
    eclipse project properties java editor save actions organize imports

Reference

  1. How To Auto Import All Class In Android Studio
(Visited 46 times, 1 visits today)
READ :   How To Convert East-Asian Character To Unicode In Java

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.