Question: a question on building executable jar files. Suppose we have a jar file *a.jar* that contains UI.class. I have used a metafile in archiving a.jar that says

```
Main-Class: UI
Class-Path: . b.jar c.jar

```

Now, if I want to ship this executable a.jar to somebody, I have to ship 3 files - a.jar, b.jar and c.jar. The user has to put all 3 in the same folder, and then double clicking on *a.jar* would work. It would be simpler if I could ship a single file (a.jar), and the JVM could figure out to extract b.jar and c.jar from in there to use the classes. These 2 are external libraries and I dont want to expand them and re-jar the class files in *a.jar*.

Can this be done? If so, what is the jar command and what should go in the metafile? Currently the command is

```
jar cmf metafile a.jar UI.class

```

Thank you.

Answer: 
Have you looked at this tool [OneJar](http://one-jar.sourceforge.net/index.php?page=getting-started&file=quickstart)? Also [this](http://www.ibm.com/developerworks/java/library/j-onejar/) is a good article to read on OneJar.

If you decide to not use an external tool then your alternative is to put the library/helper jars in the classpath in the manifest, and then copy the jars themselves in a directory path relative to your main jar.

EDIT: OP asked for an example MANIFEST.MF. I coped this from the example [One-Jar example](http://one-jar.sourceforge.net/version-0.95/) jar file.

```
Manifest-Version: 1.0
Main-Class: com.simontuffs.onejar.Boot
One-Jar-Expand: expand,doc

```
Another way can be use one of several available tools to create a setup deliverable and your setup pack will unpack your application when installed.