score:262
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
score:0
Certainly in Eclipse indigo, a yellow line appears under unused imports. If you hover over that, there will be multiple links; one of which will say "Remove unused import". Click that.
If you have multiple unused imports, just hover over one and there will be a link that allows you to remove all unused imports at once. I can't remember the exact wording off hand, but all the links that appear are pretty self explanatory.
score:0
Not to reorganize imports (not to unfold .* and not to reorder lines) to have least VCS changeset
you can use custom eclipse clenup as this answer suggests
score:3
Better way is just to add "save action" so when you save the project it will clear the unused import's and format the code as well if you like .
Go to Window > Preferences > Java > Editor > Save Actions
and pick what ever you want .
score:3
press Ctrl+Shift+O and it will remove unwanted imports
score:7
Use ALT + CTRL + O. It will organize all the imports. You can find various other options in the "Code" Menu.
EDIT: Sorry it is CTRL + SHIFT + O
score:8
If you want to do this on whole project then inside project -->select src folder-->press Ctrl+Shift+O
score:12
Remove all unused import in eclipse:
Right click on the desired package then Source->Organize Imports. Or You can direct use the shortcut by pressing Ctrl+Shift+O
Work perfectly.
score:47
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.
score:72
You can direct use the shortcut by pressing Ctrl+Shift+O
Source: stackoverflow.com
Related Query
- How to remove unused imports from Eclipse
- How to remove unused imports using Eclipse and not reorganize it?
- How to remove unused view from Eclipse RCP application
- How do I remove javascript validation from my eclipse project?
- How to remove native support from an Android Project in eclipse because eclipse is showing errors in jni?
- How do i remove m2eclipse from my eclipse installation?
- How do I remove Maven from a Eclipse java project?
- How to remove a file from an Eclipse project without deleting the file from the disk?
- Remove unused import from All projects in eclipse
- How to remove a dependency from my Android project in Eclipse
- How to remove Eclipse project related files without deleteing the source from Eclipse
- How to remove auto-discovered paths after compiling on Linux from Eclipse CDT project?
- How to remove the JavaScript facet from an Eclipse project?
- How to remove certain classes from autocompletion in Eclipse
- Make eclipse remove unused imports but keep unresolved
- How to remove file path viewer from eclipse editor view
- How to remove empty line from the end of new class - Eclipse
- How to Remove Project name from eclipse url?
- How to Remove Zend Studio Components from Existing Eclipse PDT?
- How to remove 'unremovable' consoles from eclipse
- How to remove the 'Design' tab from an xml document within Eclipse
- How to remove file system folders from eclipse package explorer view?
- How do I remove MyRadRails from my eclipse installation
- How to remove a file from a commit which is not the most recent using eclipse when their are multiple commits to be pushed
- In Eclipse how do I remove old or not needed class files from SVN
- How to remove C/C++ perspective from Eclipse
- How to remove java project from eclipse without affecting clearcase repository
- How to remove an Eclipse project from a Working Set?
- How do you programmatically remove a file from eclipse build path?
- How to remove the Junit4 from eclipse test runner
More Query from same tag
- Eclipse Helios not showing Javadoc
- How to Avoid committing to Master in Eclipse
- Unable to run android eclipse project due to unfigured errors
- I had written a simple cobol prog in ECLIPSE. But i am unable to compile,run that program
- How to Integrate Visual c++ to eclipse for opengl programming
- How to make jar file with sbt with external java jar file
- Sample messages from IOT sensors for MQTT communications
- How to call Unity C# method from Android java project by UnitySendMessage method?
- Eclipse : service not getting registered with eureka server When started from eclipse
- unable to call onDrawerOpened and onDrawerClosed
- Issue in Maven dependency when calling external jar
- How to observe the Application Context at runtime (while debugging)
- How to have an ${include_guard_symbol} in Eclipse with an uppercase file path?
- Android: Navigation Drawer NullPointerException
- Deploying and running Maven project outside Eclipse
- How to run a Lucene 4.9 IndexFiles?
- Eclipse NullPointerException on File Open
- ClassNotFoundException when running JUnit unit tests within Eclipse (using Maven)
- Is there an Eclipse command to surround the current selection with parentheses?
- Add reference to library in Eclipse
- Hide GWT output folders in Eclipse
- finding render path for file in eclipse workspace
- Appium is unable to find Android Emulator/device, unable to run code
- MapReduce chained job never ends
- Integrating a maven project into Eclipse
- Source not found!
- JSP Editor for Eclipse Juno
- Eclipse project relative path to natives
- Java - Eclipse: Externalize Strings?
- Web Service with Eclipse for WebSphere 8.0