Accepted answer

easiest method:

  1. put all source files into one directory named after your project. i.e. "projectname" you can keep this directory in your workspace or it can be somewhere else.
  2. start a new project in eclipse and name it using that same project name.
  3. uncheck the "use default location" box and find the directory where your project is unless your project is already in the workspace - then you must not uncheck the "use default location" box
  4. click 'next'.

eclipse should be smart enough to figure out what's going on. after clicking next, it will show you all of the files it found in that directory. it will just automatically add those files to your project. voilĂ !


follow this instructions from standard eclipse docs.

  1. from the main menu bar, select command link file > import.... the import wizard opens.
  2. select general > existing project into workspace and click next.
  3. choose either select root directory or select archive file and click the associated browse to locate the directory or file containing the projects.
  4. under projects select the project or projects which you would like to import.
  5. click finish to start the import.


in the package explorer and the navigation screen you should now see the project you created. note that eclipse will not copy your files, it will just allow you to use the existing source and edit it from eclipse.


there are several ways to add files to an existing java project in eclipse. so lets assume you have already created the java project in eclipse (e.g. using file -> new -> project... - and select java project).

to get java files into the new project you can do any of the following. note that there are other ways as well. the sequence is my preference.

  • drag the files into the navigator view directly from the native file manager. you must create any needed java packages first. this method is best for a few files in an existing java package.
  • use file -> import... - select file system. here you can then select exactly which files to import into the new project and in which java package to put them. this is extremely handy if you want to import many files or there are multiple java packages.
  • copy the fires directly to the folder/directory in the workspace and then use file -> refresh to refresh the eclipse view of the native system. remember to select the new project before the refresh.

the last one is what you did - minus the refresh...


while creating a project from a full folder may or may not work within the workspace, there's a condition outside of the workspace that prevents starting a new project with a full folder.

this is relevant if you use numerous folder locations for sources, for example an htdocs or www folder for web projects, and a different location for desktop java applications.

the condition mentioned occurs when eclipse is told to create a new project, and given a full folder outside the workspace. eclipse will say the folder isn't empty, and prevent creating a new project within the given folder. i haven't found a way around this, and any solution requires extra steps.

my favorite solution is as follows

  1. rename the full folder with an appended "original" or "backup.
  2. create the eclipse project with the name of the full folder before the folder was renamed.
  3. copy all the relabeled full folders contents into the new project folder.

eclipse should make a new project, and update that project with the new folder contents as it scans for changes. the existing sources are now part of the new project.

although you had to perform three extra steps, you now have a backup with the original sources available, and are also able to use a copy of them in an existing project. if storage space is a concern, simply move/cut the source rather than fully copy the original folder contents.


if you creating a new project based on an existing maven structure :

create the project using a general project wizard and give the project the same name as just created.

if you try to create the project as a maven project via m2e will receive an error that project/pom already exists.


  1. create a new project..
  2. right click on your project..
  3. select build path --> configure build path
  4. under source tab choose link source, your .java files containing folder..

i am suggesting this since none of the methods that you tried have worked ---fyi


there are two things

1- if its already a eclipse project, then simply go to file->import->general->existing project into workplace

2- otherwise define project type e.g. java, web etc create a new project of type you define into your workplace. copy paste source , lib and other necessary files. refresh, compile and run project in eclipse.


the easiest method is really good but you don't get a standard java project, i.e., the .java and .class files separated in different folders.

to get this very easily:

  1. create a folder called "projectname" on the workspace of eclipse.
  2. copy or move your folder with the .java files to the "projectname" folder.
  3. create a new java project called "projectname" (with the use default location marked).
  4. press <enter> and that's it.


this answer is going to be for the question

how to create a new eclipse project and add a folder or a new package into the project, or how to build a new project for existing java files.

  1. create a new project from the menu file->new-> java project
  2. if you are going to add a new pakcage, then create the same package name here by file->new-> package
  3. click the name of the package in project navigator, and right click, and import... import->general->file system (choose your file or package)

this worked for me i hope it helps others. thank you.


  1. right-click in the package explorer and select new - java project
  2. create the new project game
  3. open the new project in the package explorer - you should see only the source folder called src (there's nothing inside yet)
  4. open a file explorer (e.g. windows explorer) and drag your sources
  5. drag them to eclipse and drop them inside the new src folder - if asked select "copy files"
  6. eclipse should put the files into the default package, if that's not correct you can edit the offending files (marked with a red cross) by opening them in eclipse, selecting the package declaration (usually line 1), pressing ctrl + 1 and selecting the appropriate option (e.g. "move xy to package"

Related Query

More Query from same tag