Eclipse project already exists - eclipse

I deleted a project in my workspace, then tried to create a new project with the same name. Eclipse told me that it overlaps the location of another project (the one I just deleted). How do I fix this?

This is what I did.
Go to Window --> Show View --> Project Explorer
Then right click on the project name that you want to delete and Click Delete.
In the dialogue box, check 'Delete Project Contents on disk'
It worked. I was able to create the project with same name again.

I had the same problem with the IBM Integration Toolkit, which is based on Eclipse. The problem also occurs in Android Studio, which is also based on Eclipse. crazyscot seems to have the right answer at A project with that name already exists in the workspace eclipse and his solution worked for me.
You need to open up the Project Explorer view (it may already be open) and delete the project from within there.

Go to Window >> Preferences >> General >> startup and shutdown >> workspace
theen select Recent work space then click Remove and close the program and open it again

You have to manually delete the project folder from your "workspace" directory (wherever you have defined it to be).

there will be a file .project xml file in the project and its content looks like
<projectDescription>
<name>ProjectName</name>
.
.
.
</projectDescription>
here ProjectName is the name of project you can change it to whatever you want.

First you create a project in some other location with the same name of your project as before.
Now delete this project by right clicking on project > Delete.
Do not check the dialog "Delete Project Contents on Disk".
Now you move your newly created project through file manager to the original location(location where you are not able to import your project).
Then import the project from the newly moved location(location where you are not able to import your project).

After deleting the project from Eclipse IDE(Project Explorer), remove it from work space folder as well. Workspace folder path - C:\Users\username\workspace (it can be different for your system).

try moving the project and try importing

go to tab window>preferences>search workspace> then make sure in last / is not in your recent workspace. Example-:/var/www/html
your url should like above.

With the same problem, I did a text search and found an XML file containing the name of the project.
I had copied the project from another project. Let's say that I copied project A to project B. Although the XML file in the new project (B) was named for project B, it had an entry which still referred to project A. When I edited it, the problem went away.

Simply remove the .classpath and .project files and try.

Go to create new project. Once there, select the project type. Mine was PHP project. The new PHP project screen will popup. There, click create a new project and give the project name which you used before. Then press finish.

If you need a 100% risk-free strategy, just right click the project and select 'export', and put it back where it was. Then, you can either continue using the project in your current directory (with no more popups) or switch over to the directory you were working in before. The side effect of the former is that you will have a duplicate project taking up a small amount of space. If anything, finish up what you need to do in the current directory, then pull (via git) from the original directory. Or, delete the project in the current directory, and import from the original directory to the target directory for the second time - though now, since it is the proper way, the issue will be resolved.

I met this problem just and I just figure out the main reason cause this problem is your copying pom.xml from another already existing project in your workspace.
So the way is find the pom.xml in your project folder and rename <name>conflicted Project name</name>.

In 2021, Using Ubuntu 20 here is simple way to remove it.
In Eclipse main Menu
Window -> Preferences
In the search type recent workspaces
Select and delete the project. click apply changes

Removing a project from an Eclipse workspace does not delete the files by default. You have to check a checkbox for that. This is a Good Thing. As you have not checked the checkbox, you have to delete the files manually using e.g. a file manager.
Note that there are files starting with . in an Eclipse project directory, such as .project. They are considered hidden files on Unices.

go to the folder and delete the file .project. This worked for me.

Related

Can't Open Existing Project in Eclipse

I'm trying to open an existing Android project in Eclipse. I've gone to File > Import > General > Existing Project (or something like that). I've chosen the file project folder. But every time I try to open the folder, all I get is an error.
Some projects cannot be imported because they already exist in the workspace*
Is there any other way of opening my project?
You cannot import a project with a name already present in your current Eclipse workspace.
The surest way to work around that is to switch workspace (menu File / Switch workspace), and create a new workspace (in which you will be able to import that project).
A more complex solution would be to try and rename an existing project in your current workspace.
Check other causes in:
"Some projects cannot be imported because they already exist in the workspace error in Eclipse"
"Erased project from Project Explorer and cannot re-import it"
"How to import a project which you just deleted in eclipse"
I faced the same issue, But it is as designed. When people close the project, It simply makes the project unavailable in the eclipse project view. This is why people thinks that it has been completely removed from the view.
So All you have to do is to go to
Window -> Show view -> Project Explorer
Now you will see your project in the Project Explorer sidebar with a different closed folder Icon as shown in this image.
Once you right click and open project you will see the magic you are looking for.
I had the same problem and I solved it finally.
So, lets say you want to open "TEST" project on eclipse. And you project is in this path: C:\Users\Sabina Comp\Desktop then your workspace should be C:\Users\Sabina Comp\Desktop not C:\Users\Sabina Comp\Desktop\TEST.
You can switch workspace by going to File->Switch workspace->other
I hope it will help you!
Just delete the .project file and try to open the project again in Eclipse File Explorer :)
I faced the same problem. Maybe the cause of your problem is as simple as mine.
I closed (not delete) my project in the Java Browsing view. Unlike the Java view, the project becomes invisible in the Java Browsing view. So I thought I deleted the project. But turns out my project is still in use when I try to import it.
So I went to Java Browsing view and right click the blank space in the Projects panel, click Open Project and the project is back!
Right click on a working set --> properties.
You should be able to see all the projects that are available in your workspace. Select it.
Next all the projects should be listed in your working set.
Here's what worked for me:
Right click on the project > Source > Format
I guess you want to create a copy of the existing project and make changes to the new one. Or you have got a project whose name matches the name of the existing project and you want to import the new project as well.
In the first case , you just need to simply copy(Ctrl+C) and paste(Ctrl+P) in the package or project explorer in the eclipse and it will ask you for a new project name -- rather than copying the project folder in the windows explorer and renaming the project folder name.
If you have copied the project in windows explorer and tried importing the project in eclipse you will get the above error Or if u have got a project whose name matches the name of the existing project in eclipse also you will get the above error.
Solution for both -- is to delete the .project , .classpath and .settings files and import the project. It will successfully import if u have changed the folder name.
Tip: If its a maven project , you can import it as a Java Project and then RightClick on the project and Configure->Convert To maven project.
In my case, problem was -
I deleted the code directory from its location.
And at the same time I closed Eclipse.
So when I reopened Eclipse, it searched for project and couldnt get it.
I restored the code directory at original place.
Opened Eclipse.
When tried to import project again I found it in closed condition.
I opened it and it started working properly.

Eclipse won't show files in package explorer

I don't know what went wrong, because this was working before, but all of the sudden I don't have any files in my eclipse package explorer.
The workspace path appears to be correct and the file permissions are correct.
Can anyone think of what's wrong?
Refresh the project
If that does not work, close and open the project again.
I had the same problem (Probably caused when I cancelled a copying to my Dropbox folder)
I only needed to click File → Import → General → Existing Projects into Workspace and select the missing projects in the window that appeared.
Workaround
Create a blank workspace
Navigate to (File > Switch to workplace > Other)
Clik Browse > Make new folder
Click Ok in browse window
Click ok in create workspace window
Import your existing project into the new workspace
Navigate to File > Import
Click General > Existing project into workspace
Click Next
Browse and select your previous project
Click on Finish
Congrats! Now you can see your project in the package explorer by importing it.
Project Explorer -> click on "View Menu"
-> Top Level Elements -> Click on "Projects"
Don't know what causes the problem, but found a way to get the files back into the package explorer.
If you go into the path of your workspace and find your projects, then you can pack them all into a zip archive file, and from this zip archive file you can import your projects again by using the File → Import → General → Existing Projects into Workspace menu.
I don't know what causes the problem, but in my case I think it have something to do with me having my workspace in a dropbox folder.
ps. I don't know if you actually can take more than one project into one zip file and make it work, I have only tried it with one project pr. ZIP-file, but it shouldn't matter.
In 2020 on OSX I just went to Project -> Refresh and wham! my files appeared.
I had started the wrong installation of eclipse. When I started the correct installation my code showed up fine. I have both C++ and Java EE installs.
Just refresh all the projects, you able to see all missed files after you import from a workspace.
1) Make sure that you use the right workspace.
2) Choose your "workspace"-Folder "/YourWorkspace",
NOT your project folder"/YourWorkspace/yourProject"
Alternatively delete your project from your
"YourWorkspace>/.metadata/.plugins/org.eclipse.core.resources/.projects/PROJECTNAME/.location"
and restart.
Hope this helps
I had the same problem. I was not able to see the imported files in Eclipse, but there were visible in File Explorer.
After a while, I noticed that all the files were imported. They had their names changed from myFile.class to ._myFile.class.
I deleted all the imported files from my workspace by using File Explorer.
By using the same File Explorer, I copy-pasted the folders/files in the workspace.
Then in Eclipse, I refreshed the project (F5 or click-right -> Refresh or File -> Refresh)
I faced the same issue and the reason was that I choose double click on Eclipse Icon, then I need to choose Work Space.
Here I made mistake. You do not need to select folder in which has all your project files
e.g //Desktop//User//Selenium//S1A//all files related to project
In that case for workspace you choose //Desktop//User//Selenium, import your project by clicking Import for eclipse 2020 and choosing File path //Desktop//User//Selenium//S1A.
may be a rare case like in mine, but if you played with colors this may be an issue and especially, if you changed theming and did not restart, which may correct some problematic visual stuff.
Import>Existing Projects into Workspace> Select root directory> Select the folder
The solution that helped me:
create a new folder (=Java-Package) with a new name. I used the System-Filemanager.
copy the disappearing files to the new folder (=Java-Package).
correct the links (JavaCommand 'import') to the new folder.
delete the old files and the old folder.
As the problem happened in my case:
I am using Eclipse IDE 2021-12 (4.22.0) for my Java project.
After importing an existing Project into Workspace all was fine.
While building the project, same files disappeared from the 'Project Explorer'-Tree.
These files still do exist as the System-File-Explorer shows. So no file got deleted. But no more listed.
After Refresh (F5) most of the files got listed again in the 'Project Explorer'-Tree.
Without doing anything an Eclipse background process let files again disappear from the 'Project Explorer' - Tree. Compilation of the project leads to missing files.
Sometimes 3 files disappeared. Some seconds later more files disappeared. Sometimes it leads to an empty Java-Package.
This disappearance of some files happened without any input from me. It was done by the Eclipse background process. It felt like watching a movie.
What does not help in my case: Restarting of eclipse, Close and Open the project, editing the files.
In my case, the problem was due to an unwanted nested project in a subfolder. There is a pre-set filter that hides folders in that case.
For some reasons, the sub project was not shown in Project Explorer.
My solution :
delete the project (without deleting project contents on disk)
import existing projects into workspace, and do not import nested project.
You might have filtered the resource out of the project.
Select the project, right click, choose properties.
Under Resource, choose "Resource filters" - check that the name of the folder or the files was not filtered in the list under "Exclude all" (if there is one)

Eclipse projects not showing up after placing project files in workspace/projects

I've searched for 2 days and can't find anything. I find things that are close, but not what I need.
I got a new computer recently and copied all of my projects over to my new computer.
I opened Eclipse and generated a workspace, which I then closed out of Eclipse and copied my projects into the workspace/projects folder.
I reopen Eclipse and my projects do not show up at all in the package explorer.
I know that I have the correct folders in the correct directory.
The closest thread I found to this is: Eclipse - Import an existing project?
but even that didn't help, my projects already meet that...
I have tried refreshing, reopening, fooling with working sets, etc...
Just because you have a project inside the workspace directory doesn't mean Eclipse opens it or even sees it automatically. You must use File - Import - General - Import existing project into workspace to have your project in Eclipse.
For Juno: (With Source in E:\workspace and destination in C:\workspace)
Copy project directory in its entirety to the workspace directory.
(e.g. Copy E:\workspace\HelloWorld C:\workspace\helloWorld)
Start Eclipse.
Perform: File --> Import
Select: General -- > "Existing Project into Workspace"
"Next >"
Check "Select root Directory"
Select with "Browse Button"
Select "C:\workspace"
A list of existing projects will appear. Just check the ones that are in Bold (To Be Imported) then press the "Finish" button.
Review the Package Explorer and your copied projects should now be there.
This problems comes while .metadata of current workspace has been corrupted due to shut down Eclipse Unexpectedly. So if you face this problem just do the following steps:
Create a new workspace.
Import your existing projects to your new workspace.
you made it!
I had the same problem over and over again the solution that a have found works for now
Close Eclipse.
go to workspace.metadata.plugins
remove org.eclipse.core.resources
Start Eclipse
Do File->Import
General->Existing Projects into Workspace and import all the project from the workspace
Netbeans allows you to do a simple filecopy.
As you know, Eclipse doesn't work like that. You must explicitly "import" files and projects.
If you do import, and if there are no problems, then they should show up.
I'd consider:
a) making a backup of your existing workspace
b) deleting and reinstalling Eclipse
c) Trying another "test import"
You put them in the workspace/projects folder. You should put them directly in the workspace folder and then do an Import Existing Projects into workspace.
in Eclips the Package Explorer
Right click on any viewable project and select Show in -> Project Explorer
Package Explorer -> Right click -> Show in ->Project Explorer
you should be able to see all the imported projects in your Eclipse workspace
Even I had also observed the similar problem. I had closed my eclipse project because of some reason and on restart some of my file added were not visible in explorer even though corresponding file were existing.
Following solution worked for me:
Select whole workspace (Ctrl+A) ==> Righ click and press Refresh.
Or you could try:
Go to File -> Switch Workspace
Select your workspace (if shown)
As I had imported my project from a "git clone", I had to select File->Import-> Git->Project from git -> Existing local repository
Here's a specific problem I ran into when downloading a project from the internet.
Make sure you unzip correctly if it's zipped, you can sometimes get an extra level.
Make sure you place the project in the project file, not directly in workspace.
See if .project and .classpath have been renamed to _project and _classpath. You can't rename them directly so open a text document called .classpath and paste _classpath 's contents in there, saving as all files, not a .txt. _classpath can be opened with notepad.
Import the project from the file workspace. It will look for a folder called projects, your's should be inside it.
Hope this helps :)
The following worked for me.
Create a new project in eclipse.
After creating a new project in
eclipse, right click and select import.
General Import > File System
Select all the folders under your project except the root one. Click
finish.
This would create the required meta data and other internal eclipse project file system which will display your project's files.
You can also import the project directly as a file system. Follow the above steps if you are unable to import it directly.
Hi i also come across same problem, i try many options ,but finally the most easy way is,click of down arrow present inside ProjectExplorer-> customize View->filter-> unchecked close project.
And will able to see all closed projects.
I have tried many of the option suggested but at last importing project in new workspace solved my problem.
I think there is some problem in metadata files in old workspace.
I just wish to add one important detail to the answers above. And it is that even if you import the projects from your chosen root directory they may not appear in bold so you won't be able to select them. The reason for this may be that the metadata of the projects is corrupted. If you do encounter this problem then the easiest and quickest way to fix it is to rid yourself of the workspace-folder and create a new one and copy+paste your projects (do it before you erase the old workspace) folders to this new workspace. Then, in your new worskapce, import the projects as the previous posts have explained.
Yeah.... i kinda see what you need. I just came across same problem.
Here is exactly what i did. Now, bear in mind, this some low level knowledge, since i'm just starting. I made my life complicated, so i needed solution. I kinda found it on my own, using different directions from above answers.
I switched from win 10 on HDD to linux on SSD, so i needed my few of .class and .java imported into new workspace.
First i made a mistake, not using export option on windows and i just simply copied all of files from src and bin folders on win 10 to src and bin folders on linux. Of course workspace did not see those files.
Solution was found in IMPORT tool (which i should have used right away).
I put all of files in src folder into zipp file, and moved this file to some arbitrary folder (Home folder in my case).
Go back to src folder and delete all of .java files (you won't be needing them anymore).
Then i opened my empty project and selected import from File menu in Eclipse.
In import window, under option General (first one) select Import Archive.
Now simply find your zip file, and Voila! All is where it should be.
Problem: After creating a PyDev Project, the project does not show up in "PyDev Package Explorer" ;(
Solution: This is what I do to see them all in "Project Explorer":
I am using Eclipse IDE 2019-12
click on "Resource" icon at the top right corner
Now you shall see all projects show up in "Project Explorer".
Tricky note: now if you click on "PyDev" icon, you will see less projects show up in "PyDev Package Explorer" Magic?
What I did wrong about it, I used "import" - > "Projects from Folder or Archive" because I thought it would be the same thing. You have to use "Existing Projects into Workspace". Maybe this helps someone.
I experienced the same issues and I just click on Window -> Show view -> then Project explorer.
Then I got my project that was inside my eclipse workspace.

Some projects cannot be imported because they already exist in the workspace error in Eclipse

I am trying to import a project that me and my co-worker have been working on.. and keep getting this error after I select-- "import" then "import existing project" then click archive file, and then I click next, and this error comes up:
Some projects cannot be imported because they already exist in the
workspace
Uncheck the "copy projects into workspace" checkbox, and then click "refresh" button, you will be able to import the project
go to .project file in your project and change the name of the project in name tag
It has just happened to me too. Finally I realized that the project was already open in my workspace but it was not visible because of the selected working set. You have just to deselect the active working set and all opened projects will become visible.
This usually happens when you change the project directory physically without first delete in Eclipse.
You can view and delete these hidden projects in the following view:
Window -> Show View -> Other -> General -> Navigator
Then simply just continue with the process of import existing project.
In my case, I copied one of the projects (say 'Project1') from the workspace and pasted it to the same workspace. After that I modified the name of the pasted project (say to 'Project2'). I could not see it in the repository.
The main reason was .project file from the new project still had:
<name>Project1</name> instead of <name>Project2</name>.
So, I did following things in order to get the issue fixed:
Cut and paste Project2 outside the workspace
Change .project file to have <name>Project2</name>
Try importing Project2 again.
It worked for me.
You may have a project with same name in your workspace. Try to refresh (file->refresh) your workspace after deleting the another one with same name.
A typical situation occurs when you want to re-import a deleted project.
Projects in the Eclipse workspace must be unique. Note though that the project name need not be the same as the directory/folder name of the project, so you can either delete any existing project with the same name or alternatively rename the existing projects.
You have one occult directory named ".metadata" in workspace directory. Close Eclipse, delete ".metadata" and open Eclipse. When eclipse ask you about workspace make sure that ".metadata" isn't in workspace directory and click "ok" button to select default workspace.
Maybe you get the same project name in your '.project' file,check it,if yes, rename another name.than import again
If you've arrived at this because you have cloned a git project into the existing workspace and now you want to promote that workspace to a full fledged project then you should use the 'Git Repositories' view -> select 'Working Directory' -> Import Projects -> Existing projects.
Check if you have configured Eclipse to show ALL the working set. I once encountered exactly the same problem and it turned out I accidentally imported the project into the Other Projects working set. And my Eclipse configuration didn't show that working set in the package explorer, which lead me to believe that the project was not imported yet.
Updated for #Mawg:
First, click the Select Working Set...:
Then, choose No Working Sets:
This will effectively disable the working set and show all projects.
Try to rename the value of <name> tag which inside ".project" file of your project.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Rename this value</name>
<comment></comment>
<projects>
This will work for sure. Here you are just renaming your project.
EASIEST WAY: Right click on the project (folder that reads "MainActivity") go to Refactor -> Rename and you will get a text field allowing you to rename your project.
If you get an alert saying your project is out of sync with the filesystem press F5 (refresh) and try again.
Take a look in your workspace folder, you may have an old project there with the same name as the one you are importing (even though it's not being shown on eclipse).
When you delete a project on Eclipse, if you don't check the checkbox on the dialog, it just removes it from the view and doesn't delete the folder on the workspace directory.
In my case i had deleted the resources directory from my .metadata.plugins:
Go to your workspace
Enter .metadata.plugins
Delete : org.eclipse.core.resources directory
Another way I just found!
MOVE the project to some other folder and then import and if required copy to workspace
I had this issue when I deleted a project and tried to import the code again. Eclipse never really deleted the project and still held a reference to the project name/folder in the workspace. I had to created a new project with the same name and my code appeared as it was. I believe this only worked because the project path was never changed.
It was happened to me when
I delete project from eclipse Project Explorer and not checked the
remove content from disk.
Next time when I tried to import same project in workspace then got same problem.
To solve I just did FYI work that every kid can do :)
So How I solved it:
Cut Ctrl + x myProject folder from eclipse workspace to other location ie Desktop
Right Click Navigator (you can get it from Window > Show View > Navigator) and Refresh (it will prompt following dialog)
Just click Yes button and move your project folder back to eclipse workspace directory
Import again!
Now Rock 'n' Role
This warning means you just deleted project from navigator, but the project is present in the working set. Or else your working set has project with same name, so go to work-space directory and delete the project which has the same name and import again.
This worked for me.
File > New > Android Project > Create project from existing source
Location = the location of the project you want to import.
You will get a warning "An Eclipse project already exists in this directory.
Consider using File > Import > Existing Project instead." But you will be able to click "Next" and the project should in effect be imported.
In eclipse click file then select switch workspace then browse and select another folder. Now repeat the same process and this time there will be no error :)
I had a similar problem, I have the same repository I wanted to import twice. I renamed the existing project by right clicking on the project > refactor > rename then imported it again.
My problem was a little bit different.
For example, the project name (what I see) was FooProject and in the imported project, I was looking for the FooProject but I could not. However, Eclipse does not let me import that project because he claims that it is already imported. And then, I have looked at the .project file of the project and I have seen that the actual name of the project was not what I see (FooProject).
The conclusion;
The name of the project (what you see in Eclipse) may be different than the actual name of the project (what maven see). Because of this reason. Please be sure that they are the same name by checking .project file of the project.
Nothing about could not solve my situation. This is how I solved.
Close the IDE
Remove the same name project form workspace
Start the IDE
Clean all project (not sure this helped)
File > Import > Existing Project
click refresh button
import project
Done..
At least on Eclipse Juno, you can toggle on Advanced. Then select [groupid].[artifactid] from the Name Template dropdown. That should make your project uniquely named. (If you keep multiple versions of a given artifact, you can select [groupid].[artifactid].[version] instead). Be sure to click the Refresh button so the changes are visible. Wash, rinse, repeat as needed.
delete it from eclipse......u might have closed the project in eclipse by "(Rightclick)-->close project".....so even if you delete this project from workspace folder....it stays there in eclipse IDE as closed project.....you should delete it from Eclipse IDE...!!!
I have a slightly different situation whereby my eclipse stops responding and I have had to kill the session. After restarting Juno, then the particular project I was working on disappeared although .project file exists. Trying to import back into Eclipse would yield the same "Some projects cannot be imported .." or "A project with this name already exists" if trying to create a new project.
In the end, since I was using Working Sets, I managed to find this file .metadata.plugins\org.eclipse.ui.workbench\workingsets.xml. Manually added the missing entry and restarted eclipse and voila, it came back.
I had the same error because there was one more project under svn in workspace but with another name. So I've removed it.
This is what i have noticed for the above issue :- If the checkout folder (folder where your pom project resides) is same as the eclipse workspace folder then i am getting this issue
SOLUTION
when i used a separate workspace folder for importing the project, eclipse did worked smoothly :)
In case you are using Maven, make sure that your artifactId in pom.xml does not have the same name as any existing project name in your Eclipse project explorer.

In Eclipse, how to copy an existing project to another project?

In Eclipse, I have one existing project, A. Right now, I have just created another project, B, which is empty. Is it possible to copy all the files of project A, including its source code and related libraries to project B? There are a lot of involved libraries in project A. How to do this copying process correctly to ensure the copied files can still be compiled?
This question appears in Google search as top result for query "copy project in eclipse".
To copy project in Eclipse:
1) right click on project in Package Explorer view;
2) choose Copy;
3) right click on free place in Package Explorer view;
4) choose Paste;
5) enter new name in the prompt window.
To answer actual question, the best way is to delete project B and after -- copy project A as explained above and give it name B.
Close Eclipse
Copy the folder of existing project to anywhere on your disk.
Start Eclipse. Turn off the automatically build.
In the Eclipse do Refactor / Rename to the new project name. (If it connected to CVS/SVN disconnect before rename.)
Import back the old project from place where you copied in the second step.
Turn on the automatically build.
Enjoy them!
You can Import the project
OR
Assuming both project A and B are of same type:
You can copy the contents of src folder as it is.
For the libraries, just go to the build path and add them in the ssame way you did for project A.
Since B is empty, you can just copy project A in the Package Explorer and name the copy B.
Create a duplicate/copy of an existing project (in the workspace).
Then in Eclipse, click file->import
Select import existing projects into workspace
Check the radio button "Select root directory"
Browse your project (the new file you copied in workspace in step 1)
Done!
In the project Explorer, right click your old project, click "Copy", right click again click on "Paste" this time, change the default given name "Copy of My_Old_Project" to any of your choice, after the copy is done, go to the "Search" tab in Eclipse, then to --> "Search", on the File Search, type the old name of your project, make sure that your scope is only "Enclosing project", change all occurrences into the new name, run the project, you are all set...
only thing I noticed about this is that the url will still be of the old project.
For a Gradle project, I had to add two extra steps to mOna's answer, which I will copy for completeness.
Create a duplicate/copy of an existing project (in the workspace).
Then in Eclipse, click file->import
Select import existing projects into workspace
Check the radio button "Select root directory"
Browse your project (the new file you copied in workspace in step 1)
Edit .project file and change the and the to match the new project.
Edit settings.gradle and change rootProject.name to match the new project.
I assume that the renaming in some of the above answers does step 6, but I couldn't get it to work. No matter what I tried, without those extra steps the code looked ok but dependencies were not handled correctly and errors appeared everywhere. I was even able to run gradle on my project from the command line and it "built", but was actually building the old project.
Eclipse has a option in file menu like import existing projec.From that you can import the existing project with all content.I hope this is the solution that you are looking for.