Change Eclipse's project location in file-system

21,418

Solution 1

You have to change the project's name from Eclipse. In the Package explorer Right-click the project -> Refactor -> Rename. Or simply click on the project and press Alt + Shift + R. This way no configuration will be lost.

Another way would be to move the project's folder by Right-clicking on the project > Refactor > Move.

Alternatively, if you already renamed the folder's name and cannot see the project in Eclipse anymore, you can select File menu -> Import -> Existing projects into Workspace, navigate to the parent folder of your project's folder, then select the projects you want to import and press Finish.

Solution 2

It sounds like you think the name of the project comes from the workspace folder. This is not the case. The project name is contained in a hidden .project file. The refactoring tools are probably a better way to go, but that doesn't seem to be what you want.

  1. Make new proj2.0 directory.
  2. Copy hidden .project and .classpath files from proj1.0 directory to proj2.0 directory.
  3. Edit .project in a plain text editor and change the name.
  4. In Eclipse, Import Existing Projects into workspace and point to the proj2.0 directory.
Share:
21,418

Related videos on Youtube

Spiderman
Author by

Spiderman

like the web

Updated on July 11, 2020

Comments

  • Spiderman
    Spiderman almost 4 years

    I have a project of eclipse that is located in some folder on my my local-disk. Let's say: c:\proj1.0 and after a while I need to change the folder name to proj2.0 (why? because I started working on the next version of my application and I want to save the time of creating the new project in Eclipse. The older version is stored in the source control anyway)

    How can I do it? if I try to change it than the project cannot be found by eclipse. I didn't find the eclipse configuration file where the absolute location of the project is defined.

    • janhink
      janhink about 13 years
      What about Right-click on project > Refactor > Move ?
  • Spiderman
    Spiderman about 13 years
    I did it but it doesn't change the name of the folder in the file-system and this is what I'd like to do.
  • janhink
    janhink about 13 years
    That's strange because I just tried it and it definitely changes the folder name in the filesystem. Nevermind, you can still click the "File menu -> Import -> Existing projects into Workspace" and navigate to the folder with your Proj2.0. Then select the project and press Finish.
  • Spiderman
    Spiderman about 13 years
    Creating a new project even if it is imported is too complicated. I'll have then to delete from eclipse the older project because it doesn't point on any existing folder anymore. and I'll have to update tomcat to connect to the new project instead of the previous one.
  • Spiderman
    Spiderman about 13 years
    I am looking for a solution that consist of modifying the existing project instead of creating new one
  • janhink
    janhink about 13 years
    It doesn't create a new project, it just imports the "Existing project into Workspace" as the title of the operation says...
  • Spiderman
    Spiderman about 13 years
    No. when I do it I get the error: 'Some projects cannot be imported because they already exist in the workspace' message that probably refers to proj1.0 project
  • janhink
    janhink about 13 years
    Then delete the project from the workspace (but DO NOT remove the contents of the project folder in the prompt) and then do the import.
  • Spiderman
    Spiderman about 13 years
    And then I'll have to update the Tomcat server's plugin about the new project. Too many operations. I am looking for a shorter workaround. I am looking for something like refactor rename that will change the location of the existing project. I don't mind to do it from configuration files and not from eclipse UI
  • janhink
    janhink about 13 years
    I'm sure that if you renamed the project's name using the refactor method I originally described, all would go smoothly, including refactoring of your tomcat's configuration. Maybe just try to change the project's name to the original "proj1.0" and then do the refactoring. Otherwise I'm out of ideas.
  • Spiderman
    Spiderman about 13 years
    There is no connection between the name of the project and it absolute location. The project can be called 'AlfaOmega' and can be located on c:\myBizzarIdeas\2011. so I don't think that in any case Eclipse will change the name of the folder on refactor-->rename
  • janhink
    janhink about 13 years
    Sorry but I give up. Then you just have to do it manually. I can just point you into the folder [project]/.settings where one of the files can contain information about your tomcat, or there are files under you workspace's folder [workspace]/.metadata/plugins/org.eclipse.core.runtime OR org.eclipse.wst.server.core which might be of interest. Good luck
  • Mike
    Mike about 13 years
    @Spiderman "so I don't think that in any case Eclipse will change the name of the folder on refactor-->rename" have you actually tried it yet? I just tried it out on a scratch project of mine and it does in fact change the name of the folder in the workspace. It will be changed from c:\myBizzarIdeas\2011\AlfaOmega to c:\myBizzarIdeas\2011\BetaOmega
  • Learn OpenGL ES
    Learn OpenGL ES over 11 years
    I didn't have luck with this either -- the actual folder is not renamed.
  • Enerccio
    Enerccio over 9 years
    No it is not. You can modify it and it still won't import as different name.

Related