Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable star imports in Eclipse Juno

Tags:

java

eclipse

How can I disable star imports in Eclipse Juno? I only want to import the classes that I use, and the IDE imports the entire package if I import a lot of classes that are in that package.

like image 724
BJ Dela Cruz Avatar asked Oct 09 '12 19:10

BJ Dela Cruz


People also ask

How do I remove unwanted imports in eclipse?

Eclipse provide a shortcut CTRL + SHIFT + O, this shortcut command will remove all those unused imports from your code file.

How do I get rid of unwanted imports?

1) Go to the line of unused import, press Ctrl + 1, which is an Eclipse shortcut of a quick fix. This will show a drop-down menu to fix this error and one of them will be "remove unused imports." It will remove that import statement from Java file.

How do I remove unused imports from spring boot?

To remove those unused imports automatically, just click on the class and press the shortcut “Ctrl + Shift + O” to initilize the “Organize imports” feature.

What does organize imports do in Eclipse?

It's better to use the “Organize Imports” feature of Eclipse IDE to remove multiple or all unused imports statement. For using this from Menu, Select Source → Organize Imports. This will remove all unused imports from that Java file.


2 Answers

Preferences -> Java -> Code Style -> Organize Imports, then change Number of imports needed for .*.

If you change it to, say 2147483647, you should be fine.

like image 116
rolve Avatar answered Sep 21 '22 04:09

rolve


I just have Indigo here, but I think it will help you:

Go to Preferences -> Java -> Code Style -> Organize imports.

There you will have the following fields:

Number of imports needed for .*
Number of static imports needed for .*

You can change it to match your needs. The default in Eclipse Indigo is 99, which is probably a good number to avoid the .* import.

like image 44
Daniel Pereira Avatar answered Sep 20 '22 04:09

Daniel Pereira