Deliver Your Java Application in One-JAR™!

Copyright 2004-2010 by P. Simon Tuffs, All Rights Reserved. http://www.simontuffs.com




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}" />
        </javac>
        <jar destfile="${build.dir}/lib.jar" >
            <fileset dir="${classes.dir}/lib"/>
        </jar>   
        <!-- Build classes for main.jar -->   
        <javac destdir="${classes.dir}/src">
            <src path="${src.dir}" />
            <classpath path="${build.dir}/lib.jar"/>   
        </javac>
        <!-- Construct the One-JAR file -->   
        <one-jar destfile="hello.jar" manifest="hello.mf">
            <main>
                <!-- Construct main.jar from classes and source code -->
                <fileset dir="${classes.dir}/src"/>
            </main>
            <lib>
                <fileset file="${build.dir}/lib.jar" />
            </lib>
        </one-jar>
        <echo>
          Now you can run the Hello One-JAR example using 
          $ java -jar hello.jar
        </echo>   
           
    </target>

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