Over a million developers have joined DZone.

How to Add Existing Files to Eclipse Projects

· Java Zone

What every Java engineer should know about microservices: Reactive Microservices Architecture.  Brought to you in partnership with Lightbend.

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 :-)

Microservices for Java, explained. Revitalize your legacy systems (and your career) with Reactive Microservices Architecture, a free O'Reilly book. Brought to you in partnership with Lightbend.

Topics:

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}