Search code examples
javaeclipseworkspace

Eclipse: Error ".. overlaps the location of another project.." when trying to create new project


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.


Solution

  • Eclipse is erroring because if you try and create a project on a directory that exists, Eclipse doesn't know if it's an actual project or not - so it errors, saving you from losing work!

    So you have two solutions:

    1. Move the folder counter_src somewhere else, then create the project (which will create the directory), then import the source files back into the newly created counter_src.

    2. Right-click on the project explorer and import an existing project, select C:\Users\Martin\Java\Counter\ as your root directory. If Eclipse sees a project, you will be able to import it.