Deliver Your Java Application in One-JAR™!

Copyright 2004-2010 by P. Simon Tuffs, All Rights Reserved.

Ant Example.

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

If you like One-JAR then you might want to check out some of the other Open-Source projects developed by
Get One-JAR(TM) at Fast, secure and Free Open Source software downloads soap-stone at Eclipse JAR Plugin Yet Another Compiler Compiler Language