Solved

combining jars

Posted on 2013-11-14
4
162 Views
Last Modified: 2013-11-20
hi guys

We have multiple jars in our project

customCross.jar
customPath.jar


Is there anyway i can combine these two jars into one singe jar and call it
customProducts.jar?

We are deploying our project on a unix box, Any windows or unix option would be fine.
Any ideas?
thanks
0
Comment
Question by:royjayd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 19

Expert Comment

by:xterm
ID: 39648529
They are just zip files - on a Linux box in the directory containing the two jar files, do:

mkdir tmpfolder
cd tmpfolder
unzip ../customCross.jar
unzip ../customPath.jar
zip -r ../customProducts.jar *
cd .. && rm -rf tmpfolder

You will of course have to change your code to reference the new jar name afterwards.
0
 
LVL 27

Accepted Solution

by:
dpearson earned 200 total points
ID: 39648688
There are also tools available that specifically help do this, e.g. One-Jar:
http://one-jar.sourceforge.net/

Doug
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 200 total points
ID: 39648906
Yes - use a proper tool. jars contain manifests and other metadata, so they are by no means 'just zip files'. You need to be careful - unless you're sure of the manifests, e.g. you create them.
If you're using Eclipse you don't need 3rd party tools (although it might internally use a One-Jar derivative) - just export with 'dependent jars' selected
0
 

Author Closing Comment

by:royjayd
ID: 39663353
thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
check java version using powershell 13 471
Delete Android all or certain applications data programmatically 9 153
going to wrong jsp page 2 70
Java syntax, or is it Selenium 6 62
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question