Is there an equivalent of "Add existing file" (to project) in Eclipse?
I am trying to map my Visual Studio experience onto Eclipse. Right now, I wish to add a file existing somewhere on the file system into a project in Eclipse. I expect it to be copied to the project source folder.
Currently, I see only one way - switch to the windows explorer (total commander, in my case) and copy the file myself, after which to refresh the project.
Can I do the same without leaving the Eclipse IDE?
Thanks.
I had the same problem, but found yet another solution.
Let me state my problem so that we're sure we're talking about the same thing.
I had a file in a directory where a bunch of code files were and some of the files in that directory were shown as "in my project" and some of the files were missing. I wanted the missing files to appear in my project.
I simply selected the folder in my project and pressed 'F5' or right-clicked and selected 'refresh' and the files appeared in my project. It looks like that is the intended way of doing this.
File->Import->General->File System
should do it.
There you can select the file(s) from some file system folder to your project (into folder
).
Even easier. Just drag and drop the file from explorer into the correct package in Eclipse. It will ask you if you want to copy or link the file(s).
I am a newbie to Eclipse Luna (the 64 bit latest version on Windows 7) but this worked for me:
- Copy the preexisting source files you which add to your project.
- In Project Explorer, right click your project and select New > File
- In the "New File" dialog box, your project's name / folder should be displayed as the parent folder for your new (existing) source file.
- Click on the "Advanced" button at the bottom of the "New File" dialog box.
- Check the "Link to file in the file system" checkbox.
- Click the "Browse" and browse to your preexisting source.
- Click the "Finish" button at the bottom of the dialog box.