javaeclipseide

Eclipse no longer can auto import java Classes


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.


Solution

  • 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