17

I was trying to export a Java project. I was able to create a JAR file by using the option Export -> Java -> JAR file. I am not able to import this jar file into Eclipse (no import option for java). Am I doing anything wrong here?

Using Eclipse Java EE IDE for Web Developers (Version: Juno Release)

Chillax
  • 4,418
  • 21
  • 56
  • 91

7 Answers7

34

There is a simplier way than exporting and importing the jar. Lets assume your project is named MyProject123. Just:

  1. Just open the workspace with your file manager,
  2. Copy the folder MyProject123 that contains the project and paste it in an other workspace.
  3. Open eclipse and create a new Java Project named MyProject123

Eclipse will recognize that there is a project with that name in the workspace and will import it. All you have to do is to make refresh (press F5) on the new project.

borjab
  • 11,149
  • 6
  • 71
  • 98
Apfelsaft
  • 5,766
  • 4
  • 28
  • 37
8

To be able to import the project back instead of using JAR, try using 'Archive File' as follows.

Export to Archive

File -> Export...

Choose General -> Archive File as the export type like so :

enter image description here

and then,

enter image description here

Import back from the above archive

File -> Import...

Choose General -> Archive File and then set it up as follows :

enter image description here

Ashutosh Jindal
  • 18,501
  • 4
  • 62
  • 91
3

Follow follwing Steps :

Import Project -> JavaEE -> App Client Jar File -> Browse and select jar -> OK

You are done.

Nandkumar Tekale
  • 16,024
  • 8
  • 58
  • 85
  • This works. But how do we make sure that the library jar files are also present along with it? Is it possible? – Chillax Aug 16 '12 at 08:48
  • And it creates a new folder "appClientModule' under which the packages goes into. Any way of not letting that happen? Thanks – Chillax Aug 16 '12 at 09:09
  • right click on `appClientModule`-> Refactor -> Rename to whatever you want. FYI : your class files will be under `ImportedClasses` folder. – Nandkumar Tekale Aug 16 '12 at 09:13
2

Go to

File-> import Now type " existing in the search bar" Click on "import existing project into workspace" select root folder of your project

click ok to import

For video help visit https://www.youtube.com/watch?v=wsMPhZTxiF4

1

this the step u can apply to do that so.

Import Project -> JavaEE -> App Client Jar File -> Browse and select jar -> OK

codegeek
  • 11
  • 4
0

You can import jar file from Eclipse File->Import->General->Archive File

happy
  • 2,550
  • 17
  • 64
  • 109
0
File -> Import -> General -> Archive File

This will import your project in Eclipse.

Also, you will need to add libs/jars externally by configuring your buildpath.

sloth
  • 99,095
  • 21
  • 171
  • 219
k_ssup
  • 338
  • 1
  • 8