jdbc driver not found when execute from exported J

2020-07-26 15:19发布

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

4条回答
贪生不怕死
2楼-- · 2020-07-26 15:20

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

查看更多
别忘想泡老子
3楼-- · 2020-07-26 15:30

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

查看更多
女痞
4楼-- · 2020-07-26 15:30

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.

查看更多
仙女界的扛把子
5楼-- · 2020-07-26 15:31

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.

查看更多
登录 后发表回答