Login  Register

Move to native jar: nearly there, but not quite

Posted by LordSmoke on May 12, 2012; 5:21pm
URL: https://forum.jogamp.org/Move-to-native-jar-nearly-there-but-not-quite-tp3982739.html

Greetings. As mentioned in another post, I am back in semi-seclusion for the next two weeks working feverishly on my app and jogl2.

My first order of business was to shift to the fat jar distribution instead of the user-installed native libraries. The wiki helped me figure out the principle, and I have met with some success. That is, I removed the native libraries from my system, redefined my JOGL2 lib (in Netbeans) to include the desired native jars, and rebuild. It works fine from my Netbeans IDE.

I use the following code I grabbed from somewhere to package all the libraries into a single jar for distribution:


<target name="package-for-store" depends="jar">

       
        <property name="store.jar.name" value="my_app"/>


       

        <property name="store.dir" value="store"/>
        <property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>

        <echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>

        <delete dir="${store.dir}"/>
        <mkdir dir="${store.dir}"/>

        <jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
            <zipgroupfileset dir="dist" includes="*.jar"/>
            <zipgroupfileset dir="dist/lib" includes="*.jar"/>

            <manifest>
                <attribute name="Main-Class" value="${main.class}"/>
            </manifest>
        </jar>

        <zip destfile="${store.jar}">
            <zipfileset src="${store.dir}/temp_final.jar"
            excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
        </zip>

        <delete file="${store.dir}/temp_final.jar"/>

    </target>

Alas, the resulting jar gives the following error at startup:

Catched: error in opening zip file
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class javax.media.opengl.GLProfile

Same error on Windows/Linux/OS X.

All of the required files seem to be in the resulting jar.

Any suggestions as to what I am missing would be appreciated.