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

Categories

0 votes
308 views
in Technique[技术] by (71.8m points)

java - Organize Imports Automatically

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

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

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...