Eclipse: Import cannot be resolved

by Jay Jonas

Eclipse suddenly, and everyone is against you (or some) of its import are displaying the error message:

 import MyClassName cannot be resolved.

Do not panic yet. Before, you could try the following tips:

  • Clean Project command is your friend: go to Project > Clean menu.
  • If using Ant or Maven, use – clean option to clean your builds.
  • Refresh your project folder:  right click on your project folder  and click Refresh command.
  • Re-build your project.
  • Create a new Workspace and Import your project there.
  • ‘Switch’ Workspace – go to other Workspace the return back.
  • Double-check your JRE. Remove and re-add as follows:
  1. right click on your Project and click on  Properties from context menu;
  2. click on the Libraries tab;
  3. next, click on the JRE;
  4. click Remove, then OK;
  5. repeat 1-3 again, but this time add the JRE.
  • Finally, if your Target Plataform is divided into components in various folders, double check for duplicate plugins, ie plugins with same ID and version. If find one, remove it  mercilessly.

The tips can be followed in the order you prefer because not have a specific order and can work or not. Do not blame me if not. And make a backup before start.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: