Eclipse "Import cannot be resolved" error

Source: Internet
Author: User

[To] http://energykey.javaeye.com/blog/296380

 

The import *** cannot be resolved

For a long time, the problem was generally caused by copying a project or copy a copy from somewhere else.Source code,

Select project --> clean to solve the problem. Purpose of this option: Delete the. Class file in the project and re-compile the project, similar to rebuild in jbuild

If the problem persists, try to delete the import and manually import [Alt +/] one by one /]

 

Http://blog.sherifmansour.com /? P = 207

 

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

 

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.