Login  Register

Re: Need help setting up and building JOGL project

Posted by Neil on Apr 01, 2012; 1:21am
URL: https://forum.jogamp.org/Need-help-setting-up-and-building-JOGL-project-tp3873346p3874489.html

Ok well I have been playing with this today and I finally managed to get it all working.

My project is set up like this

Project
+src
++packages and classes (all my stuff)
+libs
++all the libs (12 in total)
+build.xml
+jar-in-jar-loader.zip
+SplashLogo.png

With the help of the link Sven gave and getting eclipse to save the ant build file for me to copy and modify... then finally with the help of this link

http://auralbits.blogspot.co.uk/2010/10/automating-java-application-packaging.html

I finally got everything packaged into one nice executable jar

NOTE: I don't currently have any data files for textures etc so I have not included them in the jar yet, I know that there is issues with this but I also know that it is possible so it is my next step... tomorrow, or maybe even later :S

My ant build file is below:

<project default="jar" name="Application">
       
        <property name="build" value="build"/>
        <property name="resources" value="${build}/resources"/>
        <property name="jar" value="${build}/jar"/>
        <property name="libs" value="libs"/>
        <property name="main-class"  value="com.my.MainClass"/>
        <property name="splash-logo"  value="SplashLogo.png"/>
       
        <path id="classpath">
                <fileset dir="${libs}" includes="*.jar"/>
        </path>
       
        <target name="clean">
            <delete dir="${build}"/>
        </target>
       
        <target name="compile" depends="clean">
            <mkdir dir="${resources}"/>
            <javac srcdir="." classpathref="classpath"  destdir="${resources}"/>
                <copy file="SplashLogo.png" tofile="${resources}/SplashLogo.png"/>
        </target>
       
    <target name="jar" depends="compile">
    <mkdir dir="${jar}"/>
        <jar destfile="${jar}/${ant.project.name}.jar">
            <manifest>
                    <attribute name="Main-Class" value="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader"/>
                    <attribute name="Rsrc-Main-Class" value="${main-class}"/>
                    <attribute name="Class-Path" value="."/>
                    <attribute name="Rsrc-Class-Path" value="./ gluegen-rt-natives-windows-i586.jar gluegen-rt.jar jogl-all-natives-windows-i586.jar jogl.all.jar gluegen-rt-natives-windows-amd64.jar jogl-all-natives-windows-amd64.jar gluegen-rt-natives-linux-amd64.jar gluegen-rt-natives-linux-i586.jar gluegen-rt-natives-macosx-universal.jar jogl-all-natives-linux-amd64.jar jogl-all-natives-linux-i586.jar jogl-all-natives-macosx-universal.jar"/>
                    <attribute name="SplashScreen-Image" value="SplashLogo.png"/>
            </manifest>
        <fileset dir="${resources}" includes="**/*.*"/>
        <zipfileset src="jar-in-jar-loader.zip"/>
        <zipfileset dir="${libs}" includes="gluegen-rt-natives-windows-i586.jar"/>
        <zipfileset dir="${libs}" includes="gluegen-rt.jar"/>
        <zipfileset dir="${libs}" includes="jogl-all-natives-windows-i586.jar"/>
        <zipfileset dir="${libs}" includes="jogl.all.jar"/>
        <zipfileset dir="${libs}" includes="gluegen-rt-natives-windows-amd64.jar"/>
        <zipfileset dir="${libs}" includes="jogl-all-natives-windows-amd64.jar"/>
        <zipfileset dir="${libs}" includes="gluegen-rt-natives-linux-amd64.jar"/>
        <zipfileset dir="${libs}" includes="gluegen-rt-natives-linux-i586.jar"/>
        <zipfileset dir="${libs}" includes="gluegen-rt-natives-macosx-universal.jar"/>
        <zipfileset dir="${libs}" includes="jogl-all-natives-linux-amd64.jar"/>
        <zipfileset dir="${libs}" includes="jogl-all-natives-linux-i586.jar"/>
        <zipfileset dir="${libs}" includes="jogl-all-natives-macosx-universal.jar"/>
        </jar>
    </target>
       
</project>