MoneerOmar
MoneerOmar

Reputation: 225

Eclipse not recognizing imports in same project

From time to time, Eclipse (Indigo) complains that certain classes in my projects cannot be resolved to a type. Even it shows the class in popup list, clicking import (see image) does not add the import statement! Even if I add it manually, it doesn't recognize it (and underlines the import package).

Not recognizing imports

Upvotes: 4

Views: 13303

Answers (4)

AGŞ
AGŞ

Reputation: 1

Right click on the project -> Maven -> Update Project...

Check (Force Update of Snapshots/Releases)

Upvotes: 0

Stu Blair
Stu Blair

Reputation: 1343

This just happened to be in Eclipse Neon.2 (2016 release) on a non-Maven project. Refreshing / updating the project did not help, but I was able to fix this without recreating the project:

  1. Go to Properties → Build Path → Source
  2. Remove all source folders in the build path, click Apply.
  3. Add them all back, click Apply.

Upvotes: 0

user7396627
user7396627

Reputation: 105

For those not using Maven, simply deleting the project (and possibly re-cloning it) has reliably worked for me.

Upvotes: 0

Claudiu-Florin Stroe
Claudiu-Florin Stroe

Reputation: 180

Right click on your project name ->Maven ->Update Project

Upvotes: 9

Related Questions