Meaningless Drivel is fun!*
The moose likes Other JSE/JEE APIs and the fly likes How to combine multiple JARs into one JAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "How to combine multiple JARs into one JAR" Watch "How to combine multiple JARs into one JAR" New topic
Author

How to combine multiple JARs into one JAR

rosy Jovita
Ranch Hand

Joined: Jan 05, 2010
Posts: 45
hi all,

I have 2 JAR files. For example a.jar and b.jar.
a.jar is the library to b.jar. Can I combine these JAR files so that I can run it using one JAR?
Thanks for help.
Mohamed Nahfees
Greenhorn

Joined: Mar 23, 2010
Posts: 4
Hi,

You can use fatjar to do your job. Please click here for more info.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Or jarjar, which does the same thing (as well as provide renaming/shading options) without having to be used as a plugin.
rosy Jovita
Ranch Hand

Joined: Jan 05, 2010
Posts: 45
Hi,

You can use fatjar to do your job. Please click here for more info.


have you use this before because I'm not familiar with all this. Thanks for the replied.


Or jarjar, which does the same thing (as well as provide renaming/shading options) without having to be used as a plugin.


Hi david, thanks for the replied.
I've downloaded this but i was confuse. there's not much guide on how to use it.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Not sure what kind of information you need.

http://code.google.com/p/jarjar/wiki/GettingStarted
http://code.google.com/p/jarjar/wiki/CommandLineDocs

What else?
Kabron Kline
Greenhorn

Joined: Aug 07, 2009
Posts: 20
You could also use Apache Maven, which is the preferred solution for larger projects imho.

http://maven.apache.org/

Note that using an Eclipse plugin like FatJar will be a lot easier than learning Maven...
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Suggesting Maven seems like a bit of overkill for what is a relatively simple requirement--that would require a complete overhaul of the original poster's project.
Kabron Kline
Greenhorn

Joined: Aug 07, 2009
Posts: 20
David Newton wrote:Suggesting Maven seems like a bit of overkill for what is a relatively simple requirement--that would require a complete overhaul of the original poster's project.


Indeed it may be overkill for a small project; however, Maven has features that would make the task fairly straight forward should other features that it offers be desirable.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to combine multiple JARs into one JAR
 
Similar Threads
entity bean CMR's
JavaBeans sharing two or more utility classes.
Classpath for jar files (Tiger)
How to change the Import order of jar files in WAS
How Classes Are Loaded