Import class automatically eclipse

Import class automatically eclipse

When you create new class in eclipse and start putting content in it probably many times you may had pressed Ctrl+Space to import classes from API this is OK because here your speed  is slow writing content but it could have time consuming if copy existing class form somewhere create new class from it then you need shortcut to import all related classes automatically using eclipse shortcut. Please see step below:

  • Open your class — Click anywhere on java class window
  • Press Ctrl+Shift+O
  • It will import all classes automatically (Note: If in your class path contains more than one class of same name then eclipse will show you organize imports window to choose type to import select appropriate class) and click finish once done.

Import class automatically eclipse

 

  • Alternate option to import classes automatically — Click Source — > Select Organize Imports

Import class automatically eclipse

Leave a Reply

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