How to remove unused imports from Eclipse

前端 未结 10 1100
不思量自难忘°
不思量自难忘° 2020-12-12 10:57

Is there any way to automatically remove all unused imports (signaled with a warning) of a project with Eclipse IDE?

10条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-12 11:36

    I know this is a very old thread. I found this way very helpful for me:

    1. Go to Window → Preferences → Java → Editor → Save Actions.
    2. Check the option "Perform the selected actions on save".
    3. Check the option "Organize imports".

    Now every time you save your classes, eclipse will take care of removing the unused imports.

提交回复
热议问题