简体   繁体   中英

Error java.lang.ClassNotFoundException: org.sqlite.jdbc when create jar file

I created an application on Eclipse that is connected to a sqlite database that is located in the folder project. I'm using the xerial sqlite-jdbc driver and swing for objects. When I run my application on Eclipse it works fine, but when I export the application to a single jar file it shows me the error:

java.lang.ClassNotFoundException: org.sqlite.jdbc

I tried adding the sqlite-jdbc jar file to the classpath (I'm sure that I pressed ENTER in the manifest), running this example from xerial:

java -classpath ".;sqlite-jdbc-3.7.2.jar"

But it always show the error. I read and downloaded an example from here:

http://www.codeproject.com/Tips/815186/Java-JDBC-SQLite-Read-Data-from-User-selected-db-T?msg=4911364#xx4911364xx

It's made in NetBeans and when I create the jar file for that project it doesn't have the same problem, I noticed that the jar "sqlite-jdbc-3.7.2.jar" it's included when I create the jar file for the project, but when I create the jar file for my project it doesn't include that file.

Using winrar I copied the "sqlite-jdbc-3.7.2.jar" file to the jar file of my project but it always shows the same error.(You'll think that I'm crazy trying this, but I had try a lot of things)

I had read all the question and answers on this web and other webs that presents similar or the same error, but nothing happen.

If some one knows what can I will appreciate any help

If you are using eclipse, you may want to try Runnable JAR File Exporter

蚀可运行罐

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM