Java – Eclipse: Error “.. overlaps the location of another project..” when trying to create new project

eclipsejavaworkspace

I keep getting an error message in Eclipse when creating a new project.

I have created a workspace at the level

C:\Users\Martin\Java\Counter

Inside Counter there are no files but there is a directory called counter_src which contains source files for the project Counter

So in Eclipse I do, New Java Project, and then uncheck default location and choose the directory

counter_src (which is one level down from Counter)

but it now displays

C:\Users\Martin\Java\Counter\counter_src overlaps the location of
another project: 'counter_src'

Now if I create my workspace at

C:\Users\Martin\Java\

which means my counter_src is actually 2 levels down then it allows me, but the problem is that the directory Java contains lots of projects so I wanted to create the workspace in Counter (which has no files) which has subdirectory of counter_src where my source files are.

Also tested creating directory in C:\Users\Martin\Java\ and it appears to work also but I didn't want to create another subdirectory in "C:\Users\Martin\Java\" just to store my workspace for 1 project.

Best Answer

So, I was having the same issue, but trying to import Android code via the "Import..." menu. When neither of the above two solutions worked on Eclipse Juno:

  • Eclipse -> File -> Import -> General -> Existing Project Into Workspace (NOTE: NOT 'EXISTING ANDROID PROJECT')

  • (Projects should import correctly, but should have errors. We must now attach the SDK to the project)

  • Right-Click on the project, Properties->Android->Project Build Target Choose the appropriate build target (in doubt, use 4.0.3 in the project is newish, and use 2.2 if the project is oldish)

  • Click OK

Once the project rebuilds, everything should be back in order.

(This was written when Eclipse Indigo was in vogue, and there may be changes as Google updates their tools to cover corner cases.)