Exporting a jar from Eclipse with more jar's *in* it...

From: Joe Emenaker (joe_at_emenaker.com)
Date: 04/23/04


Date: 23 Apr 2004 03:07:01 -0700

I'm writing a Java app in Eclipse. It uses some third-party jars,
which I have in my Eclipse workspace.

When I export my jar, Eclipse packs all of my class files AND all of
the jars I'm using into my exported jar. Okay... great.

However, when I try to run the jar after that, I get
NoClassDefFoundError's when it comes time to instantiate a class
that's in one of the "inner" jars.

I guess I could distribute the third-party jars separately, but then I
need to provide the user with a way to set the classpath when they run
the app (which means platform-independent "run" scripts). To get
around *that*, I guess I could unpack all of the jars into my compile
"bin/" directory with the rest of *my* stuff, but then that gets stuff
all mixed up.

Is there a way to get Eclipse to magically package a single jar which
would set the classpath to point to the jars *within* my jar (or is
that even possible with the Sun J2RE)?

If not, what's the best way that people have found to get past this
problem?

Thanks,
- Joe



Relevant Pages

  • Re: Eclipse classpath question
    ... >If I set up a file structure prior to creating the eclipse project, ... >automatically find all .jar files located under the root directory of the ... eclipse should pick up the jars under lib (not sure if it will ...
    (comp.lang.java.softwaretools)
  • Exporting a jar from Eclipse with more jars *in* it...
    ... I'm writing a Java app in Eclipse. ... the jars I'm using into my exported jar. ... I guess I could distribute the third-party jars separately, ...
    (comp.lang.java.programmer)
  • Finding Dependencies
    ... dependencies during debugging. ... Eclipse exported jars have no manifest or main class entry. ...
    (comp.lang.java.programmer)
  • Re: Konfusion beim JAR erstellen...
    ... > Wenn ich jetzt mein Programm als Jar-Datei exportiere (unter Windows ... > 2000, falls relevant), meckert Eclipse nicht, aber beim Versuch, die ... Jeglicher classpath ausser dem in des jars manifest genannten wird ...
    (de.comp.lang.java)
  • Re: My Project Works Inside Eclipse But Not When I Export
    ... I went to the Build Path Properties in eclipse, Order and Export tab, ... the external jars use some native code and a DLL in the ... it all works fine in eclipse. ...
    (comp.lang.java.programmer)