SachinJose
SachinJose

Reputation: 8522

How to import a java project missing .project .settings .classpath files into eclipse

I got a java source code from an opensource project. The source code doesn't have eclipse project specific files such as .project ,.classpath ,.setting(directory). How can I import that java source into eclipse ?


I don't have pom.xml(mvn) file to specify. So I tried manually.

followed the below steps to solve

  1. Create a directory with the projectName and a directory "src" under projectName.
  2. Move the source code ( ie: org/apache/hadoop directory) into src directory under projectName.
  3. Create a sample project in eclipse and go the workspace and modify the .project xml file by changing the project name ,.settings ,.classpath files
  4. Copy the modified ".project" file and ".settings" ,".classpath" from eclipse workspace project directory to the newly created directory "projectName/" 5 .Use eclipse import option under File menu to import the newly created project use Existing project into workspace option
  5. Give the project root directory as projectName directory.

Upvotes: 10

Views: 21331

Answers (3)

Avinav Mishra
Avinav Mishra

Reputation: 758

If this is a maven project then you will not find these .project files. So instead of using import -> Existing project to Workspace use Existing Maven Project.

enter image description here

enter image description here

Upvotes: 1

Edward Wu
Edward Wu

Reputation: 51

If you doesn't have .project .classpath and .settings file, Representing the project isn't eclipse project, so you should create a standard eclipse project

you can following below step:

  1. copy your project or open source project into workspace.
  2. window ->File ->New -> Java Project ->Project name input that just be copied project file name ->Finish

Remember config your source code location:

project ->Properties ->Java Build Path ->Source

Upvotes: 5

TheWhiteRabbit
TheWhiteRabbit

Reputation: 15758

if you are using maven type mvn eclipse:eclipse on project folder

if you are not using maven, go to eclipse, import->import -> general -> filesystem (then select your directory with source files)

Upvotes: 9

Related Questions