Eclipse "Import cannot be resolved" errorby Sherif
I'm amazed at how many shortcuts or different ways there are of doing things in eclipse.
recently I kept hitting an issue of eclipse not recognizing my imports (even though they were there ). I was always getting the message:
Import
classname cannot be resolved
.
where classname was my imported class. i'm using the myeclipse workbench 5.5.1 on Eclipse 3.2. here are a few tips on how you can fix this (some worked for me, some didn't):
- 'clean' your Eclipse project: go to project> clean in eclipse [This seems to work for me]
- refresh your project folder (right click on your project> refresh)
- re-build your project
- clean your builds (if using ant or Maven-clean your builds)
- recreate your project in eclipse
- 'Switch 'Workspace-then switch back (eg change to debug, then switch back to Java)
- 'Switch 'Workspace-then switch back (eg change to debug, then switch back to Java)
- remove and re-add your JRE:
1. right click on your project> properties
2. click on the libraries tab
3. click on the JRE
4. click remove, then OK
5. repeat 1-3 again, but add the JRE again
Hope at least one of those tips help!
Go to: http://blog.sherifmansour.com /? P = 207
The problem encountered today is that the package obviously exists, but the error that the package cannot be found suddenly. Restarting eclipse cannot solve the problem, and refresh cannot. Finally, it is solved through project-clean. The above is an articleArticle, Lists a series of methods.