Eclipse: create a Java project from “.java” and “.jar” files

Tutorial Details


Completion Time: 30 min
Difficulty: Intermmediate
Technology: Eclipse


Eclipse project 300x227 Eclipse: create a Java project from .java and .jar files


This article is about Project creation in eclipse using existing classes and libraries files. To understand how to do this, we will assume that we downloaded the OpenTS Tutorial source file from here.
In the zip file we have 9 java files and 1 jar file (the Open TS library).
We will create a project in Eclipse, add an external library to it, add a package and finally copy the java files in the package.


Part 1. Create a Java Project in Eclipse

Using the wizard of Eclipse, we will create a new java project.

createJavaProject 300x286 Eclipse: create a Java project from .java and .jar files

Remember to give a meaningfull name for your project.

ProjectName Eclipse: create a Java project from .java and .jar files


Part 2. Add an external library file to your project

Go on your project, right click and choose Properties.

ProjectProperties1 Eclipse: create a Java project from .java and .jar files

On the properties windows, choose Java Build Path on the lelft and select the Tab Libraries on the right.

JavaBuildPath libraries Eclipse: create a Java project from .java and .jar files

Click on the button “Add External JARs…” and choose the “OpenTS.jar’”

Add external jar Eclipse: create a Java project from .java and .jar files

If you did wright, you must have something like this in your Package Explorer.

PackageExplExternJar Eclipse: create a Java project from .java and .jar files


Part 3. Create a Package in your project

Go on your project, right click and choose new and then Package.
Again i will say Remember to give a meaningfull name for your Package.

PackageName Eclipse: create a Java project from .java and .jar files


Part 4. Copy java files in your project

This is the last and easiest part. Copy all the classes (.java file) from the sample project you downloaded and paste them on your project under the package you created before.

we copy:

copyClasses Eclipse: create a Java project from .java and .jar files

We paste:

pasteClasses Eclipse: create a Java project from .java and .jar files

If everything is Ok, your will have something like this on your package explorer.

PackageExplComplete Eclipse: create a Java project from .java and .jar files

The tutorial is done, you can run your project.

LiveProgramResult Eclipse: create a Java project from .java and .jar files

If you have some problems following the steps of this tutorial, let me know on the comments.

5. Links and Literature

The Open Tabu Search Library Tutorial

Eclipse

6. Images credits

Screenshots: my study challenge
Eclipse icon

7. Thank you

Support my challenge, support my blog. Please Share this article or comment it if you found it useful. Thank you.

3 commenti su “Eclipse: create a Java project from “.java” and “.jar” files

  1. Oscar il said:

    Hi, I downloaded the TS example and it has only 6 source files, but your tutorial says it has 9 Java files. Did you downloaded another version of the tutorial? Please post the link to your example files please.

Lascia una risposta

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *


*