Friday, March 22, 2013

Eclipse: Create project from existing source - How to import existing Java/Android Project into Eclipse

It seem that a lot of material on the internet, and even some Android books, refer to a mystical "Create project from existing source" option of the new project wizard in Eclipse.
I didn't know how Eclipse looked in the past, but now, in Eclipse Juno, there is no such option.
But you can still "Create project from existing source", and I'll show you how to do it :-)

I created a simple step-by-step visual guide about how to create a new project from existing source.
In this guide I've used Eclipse Juno (from the Android SDK)

1) Start Eclipse and open a new/empty workspace 

2) Click the Import command, in the File menu

3) Choose "Android\Existing Android Code Into Workspace" and click "Next"

4) The following screen will appear, we need to insert the folder path of the source files we want to use as base for our new project: we can use the "Browse" button or...

5) We can simply Copy/Paste the path of our source files :-)

6) Paste the path of our source project folder

7) Click the "Refresh" button: this will update the list of source project(s)

8) Eureka! Now we have the list of our much wanted source project(s)

9) Now, don't be hungry, click the "Deselect All" button, to uncheck all the projects

10) and now select the project you really want. I'll go for the AccelerometerPlay, I always liked the interesting things you can do with modern smartphone sensors... :-)

11) Check the option "Copy projects into workspace" so you'll work on a copy of the original project. It's best to not mess up with the original SDK samples, you never know when you'll need them again :-)

12) Click "Finish" aaaaand....

13) You are done! Welcome your new project freshly copied from the SDK source :-)

P.S.: Can you guess that the first programming language I learned was Borland Turbo Pascal 5?
The blue background IDE of those good old days left a sign in my infancy... and even 22 years after, I still feel at home with a dark blue background, yellow keywords, and white identifiers! :-)

In case you like it, here is a link to my Eclipse color theme (MaxDarkBlue Eclipse theme), It's a work in progress... but for my eyes it seem better that other themes I've checked :-)