create jar file with external jar library

L

Luigi

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?
 
S

SpaceAgeJuliet

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?
 
L

Luigi

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
 
I

IchBin

Luigi said:
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-)
 
M

Martin Gerner

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/
 
H

hawat.thufir

Luigi said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,839
Latest member
MartinaBur

Latest Threads

Top