0

I am using Eclipse & have some packages that I want to export into a JAR file (not a runnable ones). I just need it so I can import it into another Java project to use the classes.

When I exported them, most of the packages are exported but there are a few packages that appears to be empty. I've selected Export generated class files and resources and Export Java source files and resources. I also tried changing the option here and there just to figure it out but it still gives me the same results.

Is there a configuration that I missed?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Lisa
  • 1
  • 3

3 Answers3

0

You would probably be better off reusing Clean way to combine multiple jars? Preferably using Ant (that's what Eclipse is trying to do, under the scenes).

Community
  • 1
  • 1
0

When you right click on a project, then pick Export ... you can in the following menu choose Export as Java>JAR File.

Then a menu should pop up, which lets you exactly choose from a list which folders/files you want to export into the JAR. (On the left, as Select the resources to export.)

fgysin
  • 11,329
  • 13
  • 61
  • 94
  • yes, that's what I did but certain packages are not being exported. – Lisa Aug 19 '11 at 09:09
  • Ok... Can you elaborate on what kind of packages these are, i.e. give an example of a project and which packages work/which don't? – fgysin Aug 19 '11 at 09:13
  • I have a src package generally containing java classes to run the program and another package containing jaxb generated codes. These two are the packages not being exported while other packages that are exported into the Jar are javax, hibernate, apache, dom4j etc. The java classes in the src package is to be used in another Java project through this jar file that I'm trying to export. – Lisa Aug 19 '11 at 09:37
  • Hmm, strange that it does not export those when you select them actively in the menu. Maybe you could try to create a new Eclipse project, copy over the packages and export from that - this would clear out the possibility of some screwed up Eclipse project config. – fgysin Aug 19 '11 at 09:41
  • yeap, I tried that too and somehow feel strange about it too. I tried export that particular package only still the same results. I shall see what i can do. – Lisa Aug 19 '11 at 09:55
  • Today, I tried exporting the files again and it works wonders. I have no idea why it can't before this. Everything was the same I just do the same step and now all the files got exported. It's just unexplainable. Thanks for all the help btw. Appreciate it. – Lisa Aug 22 '11 at 06:43
  • You're welcome. At least it works now, was kinda puzzled before anyway that it did not in the first place... :) – fgysin Aug 22 '11 at 13:20
0

For exporting...
1. Goto File -> Export.
2. Under 'General' category select 'Archive File'.
3. Give name and path for where to save the archive.

For importing...
1. Goto File -> Import.
2. Under 'General' category select 'Archive File'.
3. Browse the exported archive.

Taha
  • 1,086
  • 1
  • 10
  • 20