Eclipse no longer can auto import java Classes
Solution 1
I have seen this behavior before. Sometimes just closing and reopening Eclipse resolves it. Sometimes I have had to recreate the project from the source, which can be painful if you have a lot of dependencies and you're not using Maven. You should also do a File/Refresh at the top level to make sure you're in sync with the filesystem
Solution 2
Try restoring the default options in 'Windows > Preferences > Java > Editor > Content Assist > Advanced'.
If it does not work, try to create a new workspace and it may solve your problem
Hope it helps!
greedybuddha
PhD student specializing in search algorithms and learning about big data.
Updated on June 29, 2022Comments
-
greedybuddha almost 2 years
A few days ago my eclipse stopped being able to auto import classes. So usually when I have a class I'm using, like BufferedReader, that I need to import I simply hit ctrl+shift+O and the imports magically appear. But now, basic imports like List or Scanner just sit there all squiggly and red. I have the 1.6JRE included as part of my project, and when I manually import them they will then work.
This is a huge annoyance and time sink now. I'm open to any suggestions to fix the problem.
-
greedybuddha almost 11 yearsAs the problem is now gone I can't test to make sure this works. But if it ever happens in the future I will try this first! a bit easier than recreating a project.
-
dani24 over 8 yearsI had to recreate the whole project, because I had imported an existent one