打开eclipse,点击windows - Preferences 依次选择Java - Editor - Save Actions,点击选择右侧的Organize imports,其前面的方框中显示对勾后点击确定即可。