Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

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.
like image 939
SachinJ Avatar asked Feb 08 '13 09:02

SachinJ


2 Answers

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

like image 44
Edward Wu Avatar answered Sep 22 '22 04:09

Edward Wu


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)

like image 177
TheWhiteRabbit Avatar answered Sep 22 '22 04:09

TheWhiteRabbit