jdbc driver not found when execute from exported Jar

2.1k views Asked by At

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

There are 4 answers

0
J. Arenas On BEST ANSWER

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

1
Alastair McCormack On

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

4
Mark Rotteveel On

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.

0
Arash moradabadi On

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.