简体   繁体   中英

Where does Eclipse save files for projects not in workspace?

Where does Eclipse save .java files for projects that are not in my workspace? Basically, I downloaded a project from a friend, and imported that project to Eclipse. I edited and created new packages and files in the project. Then, I exported the project and uploaded it to a file sharing website. A couple days later, (my computer had restarted since then), I reopened Eclipse. My files weren't there, so I tried looking for them on my computer and couldn't find anything. I went back to the website I had uploaded the files too, and all the files were completely blank.

I was thinking that the issue may have been the fact that Eclipse saves files into the project folder within the workspace. However, since the project came from my friend, that project didn't exist in MY workspace. If this is the case, then where was Eclipse storing those files whenever I saved them? Was it some sort of local memory within the Eclipse program that just gets erased when I restart my computer? Any information would be greatly appreciated.

Eclipse uses the normal file system. But if you used the import wizard Existing Projects into Workspcace without the option Copy projects into workspace or the Projects from Folder or Archive import wizard, then the folder to import was referenced and not copied. Maybe you have then deleted the supposedly copied folder. In this case, Eclipse would display a closed project folder. You can right-click the closed project folder and choose Properties : in Resource the now deleted directory is displayed as Location .

To (at least partially) restore the files you edited:

  1. Recreated the deleted folder
  2. In the recreated folder create the file .project with following content (replace Foo with the project/folder name):

     <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>Foo</name> <comment></comment> <projects> </projects> <buildSpec> </buildSpec> <natures> </natures> </projectDescription> 

  3. In Eclipse open the project: right-click and choose Open Project

  4. Right-click on the project folder and choose Restore from Local History...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM