Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > create jar file with external jar library

Reply
Thread Tools

create jar file with external jar library

 
 
Luigi
Guest
Posts: n/a
 
      05-31-2006
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?


 
Reply With Quote
 
 
 
 
SpaceAgeJuliet@gmail.com
Guest
Posts: n/a
 
      05-31-2006
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?


 
Reply With Quote
 
 
 
 
Luigi
Guest
Posts: n/a
 
      05-31-2006
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

<(E-Mail Removed)> ha scritto nel messaggio
news:(E-Mail Removed) oups.com...
> 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?

>



 
Reply With Quote
 
IchBin
Guest
Posts: n/a
 
      05-31-2006
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-)
 
Reply With Quote
 
Martin Gerner
Guest
Posts: n/a
 
      06-01-2006
"Luigi" <(E-Mail Removed)> wrote in
news:lgkfg.1861$(E-Mail Removed):

> 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
 
Reply With Quote
 
hawat.thufir@gmail.com
Guest
Posts: n/a
 
      06-01-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java -cp a.jar -jar b.jar => Works on Windows, not on Debian cyberco Java 4 02-14-2006 06:27 AM
create an exectuable jar file whose classes reference another jar in Eclipse puzzlecracker Java 2 12-20-2005 03:33 AM
Create references to external scipt files from within an external script file Mellow Crow Javascript 6 11-04-2005 01:16 PM
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters Java 0 01-05-2005 10:59 PM



Advertisments