Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to combine multiple JARs into one JAR

 
rosy Jovita
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can use fatjar to do your job. Please click here for more info.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic