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: 
There is OneJar as people have mentioned but also (especially if you are using eclipse) you can consider [fatjar](http://fjep.sourceforge.net/). 

ALternatively, you can also achieve this by using an ANT Task here's an example:

```
<target name="dist" depends="compile,static" description="Compiles and builds jar files">

    <mkdir dir="${dist}"/>

    <jar destfile="${dist}/MYAPP.jar">
        <zipfileset src="${dist}/MY_OTHER_APP.jar"/>    
        <zipfileset src="${lib}/commons-io-1.4/commons-io-1.4.jar"/>
        <zipfileset src="${lib}/commons-math-2.1/commons-math-2.1.jar"/>

        <fileset dir="${res}" includes="*"/>

        <manifest>
            <attribute name="Main-Class" value=<where your main class is>/>
        </manifest>
    </jar>
</target>

```
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.