Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Add Existing Files to Eclipse Projects

DZone's Guide to

How to Add Existing Files to Eclipse Projects

· Java Zone ·
Free Resource

Automist automates your software deliver experience. It's how modern teams deliver modern software.

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:

  1. Import
  2. Drag & Drop
  3. Copy & Paste

The first is the ‘official’ way in Eclipse, the other two are much faster and easier :-).

1. Import

To import one or multiple files, select the folder/project where I want to add the files, then use the menu File > Import:

Menu File Import

Menu File Import

Alternatively, I can use the context menu:

Import Context Menu

Import Context Menu

Then use General > File System:

Import from File System

Import from File System

In the next dialog, I can browse for the files and select them to be added:

Importing Files from FileSystem

Importing Files from FileSystem

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:

Drag and Drop to add files

Drag and Drop to add files

3. Copy & Paste

The third way is even easier:

  1. Select the files I want to add in the Explorer/File manager, and copy them (CTRL-C on Windows)
  2. 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 :-)

Get the open source Atomist Software Delivery Machine and start automating your delivery right there on your own laptop, today!

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}