Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a project from existing source in Eclipse and then find it?

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à!


  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 com.game"

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.


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.

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.