For Programmers: Free Programming Magazines  


Home > Archive > Java Help > May 2004 > help on jar.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author help on jar.
Mark

2004-05-19, 4:33 pm

Say I have a file "a.java" which uses the classes in "b.jar".

how can I make a new jar file "c.jar" which consists of "a.class" and
"b.jar" and is runnable by double clicking.

How to do that in eclipse?

Thanks!


Steve W. Jackson

2004-05-19, 5:36 pm

In article <c8gc2f$eiv$1@mozo.cc.purdue.edu>,
"Mark" <nckl535@yahoo.com> wrote:

>:Say I have a file "a.java" which uses the classes in "b.jar".
>:
>:how can I make a new jar file "c.jar" which consists of "a.class" and
>:"b.jar" and is runnable by double clicking.
>:
>:How to do that in eclipse?
>:
>:Thanks!


You don't. A jar file can't contain other jar files. They need to be
separate. Or, if you're legally allowed (depending on where your b.jar
comes from), you could extract it and create a single jar with both sets
of classes in it.

= Steve =
--
Steve W. Jackson
Montgomery, Alabama
Mark

2004-05-19, 6:32 pm

Hi Steve,

Thanks for your reply.

I had this question because I want to build an application with a certain
LookAndFeel feature which is provided by the library in a jar file. Does
that mean if I want to build a standalone application, I have to extract the
LookAndFeel jar file and add my application, then build a new jar file which
consists of all of those? Are there any other ways?

Thanks again.

Mark.

"Steve W. Jackson" <stevewjackson@charter.net> wrote in message
news:stevewjackson-986AA6.15395819052004@individual.net...
> In article <c8gc2f$eiv$1@mozo.cc.purdue.edu>,
> "Mark" <nckl535@yahoo.com> wrote:
>
>
> You don't. A jar file can't contain other jar files. They need to be
> separate. Or, if you're legally allowed (depending on where your b.jar
> comes from), you could extract it and create a single jar with both sets
> of classes in it.
>
> = Steve =
> --
> Steve W. Jackson
> Montgomery, Alabama



carl

2004-05-19, 8:32 pm

Mark wrote:

> Say I have a file "a.java" which uses the classes in "b.jar".
>
> how can I make a new jar file "c.jar" which consists of "a.class" and
> "b.jar" and is runnable by double clicking.
>
> How to do that in eclipse?
>
> Thanks!


I believe specifying the Class-Path header option in the jars Manifest file
will do what you require.

Of course you will need to specify the Main-Class attribute to point to the
fully qualified class name in a.class, and have the Class-Path set to
b.jar.

see

http://java.sun.com/docs/books/tuto...t.html#download
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com