Deliver Your Java Application in One-JAR™! Copyright 2004-2007 by P. Simon Tuffs, All Rights Reserved.

It's Simple. Really!

For a more detailed example look a the build.xml file in the One-JAR SDK, available through the Downloads page. The key Ant target to learn from is shown below:
    <import file="one-jar-ant-task.xml"/>   
    <target name="hello" depends="init">
        <!-- Build lib.jar -->   
        <javac destdir="${classes.dir}/lib">
            <src path="${lib.dir}" />
        <jar destfile="${build.dir}/lib.jar" >
            <fileset dir="${classes.dir}/lib"/>
        <!-- Build classes for main.jar -->   
        <javac destdir="${classes.dir}/src">
            <src path="${src.dir}" />
            <classpath path="${build.dir}/lib.jar"/>   
        <!-- Construct the One-JAR file -->   
        <one-jar destfile="hello.jar" manifest="">
                <!-- Construct main.jar from classes and source code -->
                <fileset dir="${classes.dir}/src"/>
                <fileset file="${build.dir}/lib.jar" />
          Now you can run the Hello One-JAR example using 
          $ java -jar hello.jar