Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to combine Jars or Include dependent Jars into One Jar

698065Jun 17 2011 — edited Jun 17 2011
Hello,

I have build a small utility using few libraries now i want to make a bundle or jar of this utility. I don't want to let use includes the jars individuals. I want to make a single jar using all the jars so user needs to include only one jar.
So i need to include the dependent Jar files into a single jar.
I got few solutions using Google.
Like:
adding a Class-Path: myjar.jar to MANIFESTfile.
simply update the jar with jar using commnad jar uf main.jar myjar.jar_

but these are not working. when i use the Class-Path option the Tree of main jar looks like

main.jar
&nbsp;&nbsp;&nbsp;&nbsp;<default-package>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; myjar.jar
&nbsp;&nbsp;&nbsp;&nbsp;META-INF
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MANIFEST.MF

How can i combine the Jars into a single Jar? Please help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 15 2011
Added on Jun 17 2011
9 comments
1,803 views