How to add a jar within another jar?

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jan 2007
Posts: 26
Reputation: rdhiravani is an unknown quantity at this point 
Solved Threads: 2
rdhiravani's Avatar
rdhiravani rdhiravani is offline Offline
Light Poster

How to add a jar within another jar?

 
0
  #1
Jun 5th, 2007
Hi,
I want to add a jar file to another jar file in such a way that my code should be able to access it(ie. internal classes of that jar).

Thanks in advance.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 706
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 84
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: How to add a jar within another jar?

 
0
  #2
Jun 5th, 2007
just unzip the jar you want to use, place it in your .classes directory and make sure you have the right import statements.
should work just fine
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 871
Reputation: vinod_javas is an unknown quantity at this point 
Solved Threads: 7
vinod_javas's Avatar
vinod_javas vinod_javas is offline Offline
Practically a Posting Shark

Re: How to add a jar within another jar?

 
0
  #3
Jun 5th, 2007
i think you have to update your current jar file..

You have to use the following code

jar uf currentfilename.jar updatefilename.jar

just use this command then both jar files can be made as single.
Adios,

Vinod......
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: How to add a jar within another jar?

 
0
  #4
Jun 5th, 2007
nesting jarfiles isn't supported.
There are some proposals to allow for it, but nothing has yet reached prototype stage.

So at current the only way would indeed be to unpack the jars into one folder and repack them as a single archive.

Better (usually) to just add them all separately to your classpath.
It's a very rare case where there is a need to repack jars, usually it's only applicable when deploying packages to an application server where they would interfere with older versions of those same packages that the application server needs internally, a situation rare enough that most people never encounter it (I myself only have seen it once so far in a decade of using Java professionally).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 26
Reputation: rdhiravani is an unknown quantity at this point 
Solved Threads: 2
rdhiravani's Avatar
rdhiravani rdhiravani is offline Offline
Light Poster

Re: How to add a jar within another jar?

 
0
  #5
Jun 7th, 2007
Thanks to all for replying.

I found that packing a jar in other jar is possible(like any other file), but using the packages inside the jar is not possible.
The only way is to unpack the jar, & repack the classes of it in final jar file.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1
Reputation: puspendu is an unknown quantity at this point 
Solved Threads: 1
puspendu puspendu is offline Offline
Newbie Poster

Re: How to add a jar within another jar?

 
-1
  #6
Jul 7th, 2007
unzip all jars in a directory and then make the new jar including all dependencies because
Nested Jar is still not Supported
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 45
Reputation: satish.paluvai is an unknown quantity at this point 
Solved Threads: 1
satish.paluvai satish.paluvai is offline Offline
Light Poster

Re: How to add a jar within another jar?

 
0
  #7
Jul 8th, 2007
how to unzip a jar file?
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,619
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 468
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: How to add a jar within another jar?

 
0
  #8
Jul 8th, 2007
JAR files are normal zip files. Use any zipping software like Winrar or Winzip to open them.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: How to add a jar within another jar?

 
0
  #9
Jul 8th, 2007
Or jar. jar can not just create jar files, it can also read and extract them.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 45
Reputation: satish.paluvai is an unknown quantity at this point 
Solved Threads: 1
satish.paluvai satish.paluvai is offline Offline
Light Poster

Re: How to add a jar within another jar?

 
0
  #10
Jul 9th, 2007
can u tell me the dos command for unzipping the jar file?
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC