jdbc driver not found when execute from exported Jar

时光总嘲笑我的痴心妄想 提交于 2019-12-09 21:18:32

问题


I have a Java applet, it works correctly when executed from eclipe, but I want to export it to a Jar and use it. but when I do that, i get jdbc driver not found, it seems like when exporting, jaybird is not exported.

For exporting I use eclipse export and choose Java/JAR File, in build path i have jaybird mark to export.

Any suggestions? Thanks in advance


回答1:


Use Fat Jar to build runnable JARs that contain all dependent libs




回答2:


You are most likely missing the files from the META-INF folder of the Jaybird jar file. These files are required for Jaybird to work. Another possibility is that you are missing one of the required dependencies of Jaybird (connector-api-1.5.jar, for Jaybird 2.2 or mini-j2ee.jar for earlier versions).

Even if you get this to work though, you will most likely experience an error later on, as Jaybird wasn't developed with support for applets in mind, see http://tracker.firebirdsql.org/browse/JDBC-254 and NoClassDefFoundError with jdbc applet

BTW: Why don't you just use the jar as is. IMHO creating fat jars including all your dependencies is ugly and inflexible.




回答3:


I finally get the answer, I had to sign the jaybird jar also because that jar was doing read/write operation in HDD




回答4:


By using Eclipse you can simply solve the problem. By going to Eclipse -> File -> Export -> Runnable JAR file and selecting Extract required libraries into generated JAR option, Eclipse will extract required libraries beside your project and creates the required MANIFEST.MF file for you and then will pack them all together in your JAR file.



来源:https://stackoverflow.com/questions/12654452/jdbc-driver-not-found-when-execute-from-exported-jar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!