Eclipse "Import cannot be resolved" error

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.