2

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

J. Arenas
  • 493
  • 1
  • 9
  • 23
  • Make sure in Eclipse you use the option that involves packing libraries into the .jar I believe. – Austin Sep 29 '12 at 16:45
  • You can try adding your require Jar in a lib folder in the project. – Rohit Jain Sep 29 '12 at 16:45
  • @Austin that is using Runnable JAr File and I only have FBCommandLine launch configuration and it gives me an error – J. Arenas Sep 29 '12 at 17:02
  • @J.Arenas This option? http://puu.sh/19Kpt – Austin Sep 29 '12 at 17:11
  • what about an installer? It will hold all the jars as one install pack. Anyway, for netbeans, I have used this one http://www.coderanch.com/t/419419/vc/there-way-netbeans-include-external. There are lot of suggestions, I have used the DOS SCRIPT – PeakGen Sep 29 '12 at 19:09
  • @Austin the problem with that is that automatically it selects FBCommandLine as Launch configuration and it gives me an error – J. Arenas Sep 30 '12 at 10:09

4 Answers4

1

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

Alastair McCormack
  • 26,573
  • 8
  • 77
  • 100
  • I tried it but when I try to execute I get subprogram not initialized and the browser dont show the applet – J. Arenas Sep 29 '12 at 17:06
1

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.

Community
  • 1
  • 1
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • Please explain "use the jar as is", do you mean to add in the applet html tag archive=jaybird" ? – J. Arenas Sep 30 '12 at 13:15
  • In general I would advice not to use applets. But if you really have to: you can specify additional archives in the `ARCHIVE` attribute of the applet tag. See http://docs.oracle.com/javase/1.4.2/docs/guide/misc/applet.html – Mark Rotteveel Sep 30 '12 at 13:36
  • I've tried that but some times I get subprogram not initialized, but that would be other problem, thanks! – J. Arenas Sep 30 '12 at 14:05
  • 1
    I finally get the answer, I had to sign the jaybird jar also because that jar was doing read/write operation in HDD – J. Arenas Oct 10 '12 at 08:16
1

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

J. Arenas
  • 493
  • 1
  • 9
  • 23
0

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.

Arash moradabadi
  • 230
  • 1
  • 12