How To Auto Import All Java Classes In Eclipse

When you develop a 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 your 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 the java source file.
  2. Click Source —> Organize Imports menu item or Shift+Ctrl+O in Eclipse, then the java class will be imported in the java source file automatically.

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.
  2. Then click Java Editor —> Save Actions menu item in the left panel. Check the related checkbox in the right panel. In this case, we should check the checkbox Organize imports. And then click Apply and Close button to save changes. Now when you click the save button to save a java source file, all the referenced java classes in this java file will be imported automatically.

Reference

  1. How To Auto Import All Class In Android Studio

Leave a Comment

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.