This Tip sounds very basic, but still: I get asked about this about once a week. So it must be something non-obvious in Eclipse then ;-): how to add existing files to an Eclipse project. As with many things in Eclipse, there is not a single way to do something. There are two basic ways to do this:
- Drag & Drop
- Copy & Paste
The first is the ‘official’ way in Eclipse, the other two are much faster and easier :-).
To import one or multiple files, select the folder/project where I want to add the files, then use the menu File > Import:
Alternatively, I can use the context menu:
Then use General > File System:
In the next dialog, I can browse for the files and select them to be added:
2. Drag & Drop
While the ‘Import’ method is fine, I rarely use it: too many clicks! A easier way (at least under Windows) is to drag & drop the files from the Windows Explorer:
3. Copy & Paste
The third way is even easier:
- Select the files I want to add in the Explorer/File manager, and copy them (CTRL-C on Windows)
- Paste them in the project/folder in Eclipse (CTRL-V on Windows)
That last method does not advanced options like if I want to link to the files, see “Link to Files and Folders in Eclipse“, but is definitely the fastest and easiest way.
Happy Adding 🙂