944,167 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 18918
  • Java RSS
You are currently viewing page 1 of this multi-page discussion thread
Jun 5th, 2007
0

How to add a jar within another jar?

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 2
Light Poster
rdhiravani is offline Offline
36 posts
since Jan 2007
Jun 5th, 2007
0

Re: How to add a jar within another jar?

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
Reputation Points: 938
Solved Threads: 357
Posting Maven
stultuske is offline Offline
2,528 posts
since Jan 2007
Jun 5th, 2007
0

Re: How to add a jar within another jar?

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.
Reputation Points: 119
Solved Threads: 7
Practically a Posting Shark
vinod_javas is offline Offline
871 posts
since Feb 2007
Jun 5th, 2007
0

Re: How to add a jar within another jar?

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).
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Jun 7th, 2007
0

Re: How to add a jar within another jar?

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.
Reputation Points: 10
Solved Threads: 2
Light Poster
rdhiravani is offline Offline
36 posts
since Jan 2007
Jul 7th, 2007
-1

Re: How to add a jar within another jar?

unzip all jars in a directory and then make the new jar including all dependencies because
Nested Jar is still not Supported
Reputation Points: 9
Solved Threads: 1
Newbie Poster
puspendu is offline Offline
1 posts
since Jul 2007
Jul 8th, 2007
0

Re: How to add a jar within another jar?

how to unzip a jar file?
Reputation Points: 9
Solved Threads: 1
Light Poster
satish.paluvai is offline Offline
45 posts
since Mar 2007
Jul 8th, 2007
0

Re: How to add a jar within another jar?

JAR files are normal zip files. Use any zipping software like Winrar or Winzip to open them.
Super Moderator
Featured Poster
Reputation Points: 3241
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,873 posts
since Jun 2006
Jul 8th, 2007
0

Re: How to add a jar within another jar?

Or jar. jar can not just create jar files, it can also read and extract them.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Jul 9th, 2007
0

Re: How to add a jar within another jar?

can u tell me the dos command for unzipping the jar file?
Reputation Points: 9
Solved Threads: 1
Light Poster
satish.paluvai is offline Offline
45 posts
since Mar 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: selecting radio button values
Next Thread in Java Forum Timeline: Refresh a table





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC