[英]com.mysql.jdbc.Driver not found in Runnable jar file
I have implemented simple Swing application which creates database and added mysql-connector-java-5.1.18-bin.jar to my projects build path. 我已经实现了简单的Swing应用程序,它创建数据库并将mysql-connector-java-5.1.18-bin.jar添加到我的项目构建路径中。 it works fine when I run in Eclipse as a project.
当我在Eclipse中作为项目运行时,它工作正常。 But I exported this project to runnable jar file it doesnt work.
但我将此项目导出到runnable jar文件它不起作用。
I write some code to print exceptions to file. 我写了一些代码来打印文件的异常。 It gives this line : java.lang.ClassNotFoundException : com.mysql.jdbc.Driver
它给出了这一行: java.lang.ClassNotFoundException:com.mysql.jdbc.Driver
I already added required jars to my project. 我已经为我的项目添加了必需的罐子。 I cant understand why it doesnt work ?
我不明白为什么它不起作用?
It seems that your JAR is not having the required libraries. 您的JAR似乎没有所需的库。
You need to export the application using the option Package required libraries into generated JAR
. 您需要使用选项
Package required libraries into generated JAR
将应用程序导出Package required libraries into generated JAR
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.