Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
307 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.

This is how it looks like: enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...