How to remove unused imports in Eclipse
Often times, after code refactor or bug fixed, Eclipse IDE will show a yellow underline for all unsed imports at the top of your class and said “The import xxx is never used“.
To remove those unused imports automatically, just click on the class and press the shortcut “Ctrl + Shift + O” to initilize the “Organize imports” feature.
Alternatively, in Eclipse IDE, select “Source” > “Organize imports”
nice, but a project contains lot number of classes. one or more classes may have unused imports. we can remove all the unnecessary imports in a project with one click. i.e.,
select project–>right click–>source–>organise imports.
It will remove all the unused imports at a time.
so, we can do this on project level basis, package level basis or class level.
We can even keep a preference for save to remove the unused imports.
Nice. We can also set up our eclipse workspace with this rule always. Thats what I do 🙂
Nice to remove code cleanup. but i have issue to add black line in that import place.
Can you guide me how to remove blank line in between import statement?