How to remove unused imports from Eclipse
You can direct use the shortcut by pressing Ctrl+Shift+O
I know this is a very old thread. I found this way very helpful for me:
- Go to Window → Preferences → Java → Editor → Save Actions.
- Check the option "Perform the selected actions on save".
- Check the option "Organize imports".
Now every time you save your classes, eclipse will take care of removing the unused imports.
I just found the way. Right click on the desired package then Source
-> Organize Imports
.
Shortcut keys:
- Windows: Ctrl + Shift + O
- Mac: Cmd + Shift + O