create jar file with external jar library

Discussion in 'Java' started by Luigi, May 31, 2006.

  1. Luigi

    Luigi Guest

    Hi,
    in my application there are several import from an external library, in
    Eclipse i've added this library in Project -> Properties -> Java Build
    Path -> Add External JARs.

    Well, when i export as a Jar file this "jade.jar" library is not in my jar
    file and the application cannot run.

    I've tried even to manually modify the manifest.mf file adding the row:
    Class-Path: jade.jar (adding even the file in the jar)... but this is not a
    solution

    Is there a solution?
    Luigi, May 31, 2006
    #1
    1. Advertising

  2. Luigi

    Guest

    are you trying to export your code, with an library attached?
    i do not know of a way to do this.

    Perhaps you can just import the jar file as classes (unpack with
    something like winzip and add the workspace as if it was your code
    package), and then it will create a jar with all the code in it.

    would that work around solve your problem?


    Luigi wrote:
    > Hi,
    > in my application there are several import from an external library, in
    > Eclipse i've added this library in Project -> Properties -> Java Build
    > Path -> Add External JARs.
    >
    > Well, when i export as a Jar file this "jade.jar" library is not in my jar
    > file and the application cannot run.
    >
    > I've tried even to manually modify the manifest.mf file adding the row:
    > Class-Path: jade.jar (adding even the file in the jar)... but this is not a
    > solution
    >
    > Is there a solution?
    , May 31, 2006
    #2
    1. Advertising

  3. Luigi

    Luigi Guest

    there are a lot af classes to add in this way, i hope in a more feasible
    solution, but if this is the only one...

    Thx

    <> ha scritto nel messaggio
    news:...
    > are you trying to export your code, with an library attached?
    > i do not know of a way to do this.
    >
    > Perhaps you can just import the jar file as classes (unpack with
    > something like winzip and add the workspace as if it was your code
    > package), and then it will create a jar with all the code in it.
    >
    > would that work around solve your problem?
    >
    >
    > Luigi wrote:
    >> Hi,
    >> in my application there are several import from an external library, in
    >> Eclipse i've added this library in Project -> Properties -> Java Build
    >> Path -> Add External JARs.
    >>
    >> Well, when i export as a Jar file this "jade.jar" library is not in my
    >> jar
    >> file and the application cannot run.
    >>
    >> I've tried even to manually modify the manifest.mf file adding the row:
    >> Class-Path: jade.jar (adding even the file in the jar)... but this is not
    >> a
    >> solution
    >>
    >> Is there a solution?

    >
    Luigi, May 31, 2006
    #3
  4. Luigi

    IchBin Guest

    Luigi wrote:
    > Hi,
    > in my application there are several import from an external library, in
    > Eclipse i've added this library in Project -> Properties -> Java Build
    > Path -> Add External JARs.
    >
    > Well, when i export as a Jar file this "jade.jar" library is not in my jar
    > file and the application cannot run.
    >
    > I've tried even to manually modify the manifest.mf file adding the row:
    > Class-Path: jade.jar (adding even the file in the jar)... but this is not a
    > solution
    >
    > Is there a solution?
    >
    >


    I never include Jar files in my exported jar file. I just run my main
    jar with the classpath including all of the external jar files.

    Ex...
    javaw -classpath
    ...\lib\foxtrot.jar;..\lib\forms-1.0.6.jar;..\lib\looks-2.0.jar;..\lib\metouia.jar;..\lib\kunststoff.jar;..\lib\gtkswing.jar;..\lib\quaqua.jar;..\lib\hsqldb.jar;..\lib\JQuotesApp.jar
    weconsultants.org.jquotesapp.JQuotesAppManager

    Thanks in Advance...
    IchBin, Pocono Lake, Pa, USA
    http://weconsultants.servebeer.com/JHackerAppManager
    __________________________________________________________________________

    'If there is one, Knowledge is the "Fountain of Youth"'
    -William E. Taylor, Regular Guy (1952-)
    IchBin, May 31, 2006
    #4
  5. "Luigi" <> wrote in
    news:lgkfg.1861$:

    > Hi,
    > in my application there are several import from an external library,
    > in Eclipse i've added this library in Project -> Properties -> Java
    > Build Path -> Add External JARs.
    >
    > Well, when i export as a Jar file this "jade.jar" library is not in my
    > jar file and the application cannot run.
    >
    > I've tried even to manually modify the manifest.mf file adding the
    > row: Class-Path: jade.jar (adding even the file in the jar)... but
    > this is not a solution
    >
    > Is there a solution?
    >
    >


    If you are using Eclipse, check out FatJar. It solved my (identical)
    problem.
    http://fjep.sourceforge.net/

    --
    Martin Gerner
    Martin Gerner, Jun 1, 2006
    #5
  6. Luigi

    Guest

    Luigi wrote:
    > Hi,
    > in my application there are several import from an external library, in
    > Eclipse i've added this library in Project -> Properties -> Java Build
    > Path -> Add External JARs.
    >
    > Well, when i export as a Jar file this "jade.jar" library is not in my jar
    > file and the application cannot run.
    >
    > I've tried even to manually modify the manifest.mf file adding the row:
    > Class-Path: jade.jar (adding even the file in the jar)... but this is not a
    > solution
    >
    > Is there a solution?


    here's some stuff I did a while back:

    [thufir@arrakis bin]$
    [thufir@arrakis bin]$
    [thufir@arrakis bin]$ date
    Tue Aug 2 08:56:50 IST 2005
    [thufir@arrakis bin]$ ll
    total 16
    -rw-rw-r-- 1 thufir thufir 2511 Aug 2 08:49 ControlTidy.jar
    drwxrwxr-x 2 thufir thufir 4096 Aug 2 08:55 lib
    [thufir@arrakis bin]$ ll lib/
    total 156
    -rw-rw-r-- 1 thufir thufir 147859 Aug 2 08:54 Tidy.jar
    [thufir@arrakis bin]$ jar -tf ControlTidy.jar
    META-INF/
    META-INF/MANIFEST.MF
    atreides/
    atreides/tidyXhtml/
    atreides/tidyXhtml/BasicTidy.class
    atreides/tidyXhtml/ControlTidy.class
    atreides/tidyXhtml/Test16.class
    [thufir@arrakis bin]$ jar -xf ControlTidy.jar
    [thufir@arrakis bin]$ ll
    total 32
    drwxrwxr-x 3 thufir thufir 4096 Aug 2 08:57 atreides
    -rw-rw-r-- 1 thufir thufir 2511 Aug 2 08:49 ControlTidy.jar
    drwxrwxr-x 2 thufir thufir 4096 Aug 2 08:55 lib
    drwxrwxr-x 2 thufir thufir 4096 Aug 2 08:57 META-INF
    [thufir@arrakis bin]$ cat META-INF/MANIFEST.MF -n
    1 Manifest-Version: 1.0
    2 Ant-Version: Apache Ant 1.6.4
    3 Created-By: 1.5.0_02-b09 (Sun Microsystems Inc.)
    4 Main-Class: atreides.tidyXhtml.ControlTidy
    5 Built-on: 2005-08-02T08:49:14
    6 Class-Path: lib/Tidy.jar
    7
    [thufir@arrakis bin]$ java -jar ControlTidy.jar
    [thufir@arrakis bin]$ ll
    total 100
    drwxrwxr-x 3 thufir thufir 4096 Aug 2 08:57 atreides
    -rw-rw-r-- 1 thufir thufir 2511 Aug 2 08:49 ControlTidy.jar
    -rw-rw-r-- 1 thufir thufir 16083 Aug 2 08:58 err.txt
    drwxrwxr-x 2 thufir thufir 4096 Aug 2 08:55 lib
    drwxrwxr-x 2 thufir thufir 4096 Aug 2 08:57 META-INF
    -rw-rw-r-- 1 thufir thufir 42366 Aug 2 08:58 out.txt
    [thufir@arrakis bin]$ date
    Tue Aug 2 08:58:09 IST 2005
    [thufir@arrakis bin]$


    Note line 4 of the manifest, sets the Main-Class and line 6, which sets
    the class-path for a needed external jar file.

    As to editing a manifest manually, I'd use Ant to do that automagically
    instead.


    HTH,

    Thufir
    , Jun 1, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    567
    Arnold Peters
    Jan 5, 2005
  2. muttley
    Replies:
    0
    Views:
    2,718
    muttley
    Oct 20, 2005
  3. puzzlecracker
    Replies:
    2
    Views:
    5,126
    Jean-Francois Briere
    Dec 20, 2005
  4. cyberco
    Replies:
    4
    Views:
    3,752
    Roedy Green
    Feb 14, 2006
  5. Mellow Crow
    Replies:
    6
    Views:
    418
    Richard Cornford
    Nov 4, 2005
Loading...

Share This Page