Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't eclipse resolve class in same package?

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

like image 447
Cedric Reichenbach Avatar asked Jul 19 '12 20:07

Cedric Reichenbach


People also ask

How do I import the same project twice in Eclipse?

Instead of importing the project, begin creating a new project with a different name. Then change the location of the project to your new existing project. Eclipse will then let you create the project using the existing directory and content. In my opinion this is the only answer that directly addresses the question.

Why import option is not working in Eclipse?

Try this: Go to Preferences » Java » Editor » Content Assist » Advanced. Make sure Other Java Proposals is ticked/checked. If that does not work simply close the project and reopen it.


2 Answers

Alternatively, you can highlight the project :

Choose Clean ... from Project menu and if you have activated the Build Automatically option (in the same menu), the classes will be generated anew.

like image 155
samorai Avatar answered Oct 01 '22 04:10

samorai


I could resolve it: On another project (from the same git repo), I had the same issue on several files in different packages. All I had to do was writing a white-space into the file, remove it again and save, so eclipse would re-compile it (I guess).

Some kind of a strange behaviour... :S

like image 38
Cedric Reichenbach Avatar answered Oct 01 '22 05:10

Cedric Reichenbach