Take the 2-minute tour ×

When using Eclipse, I find myself typing Ctrl+Shift+O several times, to organize imports (usually imports which are no longer required, generating warnings).

Is there a way to make Eclipse organize my imports every once in a while or, at least, every time I save a file?

share|improve this question
add comment

4 Answers

up vote 43 down vote accepted

Preferences->Java->Editor->Save Actions->Configure...

You can configure the removal of unused imports when saving from the Unnecessary Code tab.

Adding imports would normally be done as you are writing the code otherwise it won't compile.

share|improve this answer
I never knew about Save Actions before. Useful stuff, thanks. –  Phill Sacre Jun 9 '11 at 13:31
Exactly what I was looking for. –  EclipseQuestion Jun 9 '11 at 14:07
add comment

Either: <project>->Properties->Java Editor->Save Actions



share|improve this answer
add comment

Yes, it is called Save Actions. There you can enable several thing should be done when saving a file.

share|improve this answer
add comment

Your Answer


