Eclipse no longer can auto import java Classes

13,673

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

  1. Try restoring the default options in 'Windows > Preferences > Java > Editor > Content Assist > Advanced'.

  2. If it does not work, try to create a new workspace and it may solve your problem

Hope it helps!

Share:
13,673
greedybuddha
Author by

greedybuddha

PhD student specializing in search algorithms and learning about big data.

Updated on June 29, 2022

Comments

  • greedybuddha
    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
    greedybuddha almost 11 years
    As 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
    dani24 over 8 years
    I had to recreate the whole project, because I had imported an existent one