I am trying to build a single jar file for my project with all other libraries included (database drivers, etc). The build process works fine and I am able to create the jar. I am using Netbeans IDE for the same.
My problem: When I run the jar file directly by double clicking it, jdbc (sqlite) driver doesn't work. Although when I run it from command line using java -jar myproject.jar, it works fine.
Here's the portion of build.xml that I use for making a single jar:
<target name="-post-jar">
<property name="store.jar.name" value="myproject"/>
<property name="store.dir" value="dist"/>
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
<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>
Also interestingly, all other libraries (like jcalender) that I've used work well, except sqlite-jdbc. Any thoughts on why this may be happening?
Note : I also don't get any exceptions, ClassNotFoundException or such.
Aucun commentaire:
Enregistrer un commentaire