java - SQLite JDBC driver not working in Win 7 and Ubuntu -


i trying build single jar file project other libraries included (database drivers, etc). build process works fine , able create jar. using netbeans ide same.

my problem: when run jar file directly double clicking in windows 7 or ubuntu, jdbc (sqlite) driver doesn't work. although when run command line using java -jar myproject.jar, works fine. working fine in windows 8 , mac os double clicking.

here's portion of build.xml use making 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} single jar @ ${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, other libraries (like jcalender) i've used work well, except sqlite-jdbc. thoughts on why may happening?

note : don't exceptions, classnotfoundexception or such.

edits :

  1. when use print statement (by mean writing file) before , after jdbc connection statement, nothing happens in win 7/ubuntu.

  2. i tried using same version of jre of mac os , win 8 (i.e. jre 1.8) on ubuntu, thinking maybe causing problems. nope, no luck there.

my database connection code :

        class.forname("org.sqlite.jdbc");                     sqliteconfig config = new sqliteconfig();           config.enforceforeignkeys(true);           system.out.println(config.toproperties());         errorlog.write_to_file("fetching connection");                     connection conn = drivermanager.getconnection("jdbc:sqlite:data.db",config.toproperties());         statement stmt=conn.createstatement();         errorlog.write_to_file("connected"); 

the errorlog class writes errors file. please note portion in try-catch block. in catch block, again use errorlog write file

i've put database file in same folder jar file.


Comments