Why can't eclipse resolve class in same package?

Viewed 64229

I hit F5 ~1000 times and restarted eclipse (also with -clean), deleted /bin, but nothing helps. Manually importing DoodleClient does not help. DoodleClient exists and is perfectly fine, everything worked before. Clicking on "Import 'DoodleClient' ..." does nothing.

What I did before this problem occured:

  1. I added *.class to .gitignore
  2. git rm *.class
  3. On the next pull, hunderts of .class files were deleted by git

enter image description here

17 Answers

Right click on project then R-click on Maven then Update Project

Right click on project-> Build Path ->Configure Build Path->Java Build Path -> then Fix issues in JRE System Library

Tried many of the suggestions above w/o success (Eclipse restart, Clean multiple times, auto-suggest etc.). What got me out of this bind was a hard reset to a prior commit (I'm using git), building (this time w/ success), then pulling the latest sources of the project again and rebuilding.

In my case it was that my Java Build Path -> Source didn't had checked the Contains test sources on my include source path and my code was JUnit

I've had the same problem with my Java project in eclipse. mvn clean-ing the project did not help strangely. I had to edit the supposedly "missing" class, save it, then clean and rebuild the project. That fixed the issue.

Related