Remove all unused imports in one go using Eclipse IDE

Avatar

Avatar
Validate 10
Level 3
RashidJorvee
Level 3

Likes

28 likes

Total Posts

54 posts

Correct reply

1 solution
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Validate 10
Level 3
RashidJorvee
Level 3

Likes

28 likes

Total Posts

54 posts

Correct reply

1 solution
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile
RashidJorvee
Level 3

23-07-2020

Many times we face problem where some unwanted imports get added in the our program file. It is very annoying and time consuming task to remove those unused imports one by one, to make our code clear and readable.
But we do have a shortcut for this, just in a millisecond our Eclipse IDE done this job for us. Eclipse provide a shortcut CTRL + SHIFT + O, this shortcut command will remove all those unused imports from your code file.
 
To do so, click anywhere in your java file and press CTRL+SHIFT+O. After using this shortcut command Eclipse will remove all the unused import from your java file. Below are the screenshots:

Before:

Unused imports in .java fileUnused imports in .java file

 

After:

After removing unused importsAfter removing unused imports

Replies

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,200 likes

Total Posts

6,394 posts

Correct reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,200 likes

Total Posts

6,394 posts

Correct reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

10-08-2020

Thank you for sharing this wonderful article. @RashidJorvee , Please keep on sharing such phenomenal articles with AEM Community here.