When exporting my java project with embedded firebird I get the message in the console that says:
“no jaybird[22[Any version, I guess]] in java.library.path”.
But it is literally on the library path of my project self referenced to my workspace. I’ve tried many workarounds like
System.LoadFile("jaybird22.dll") //full uri, just the name of the dll, nada
System.Load("jaybird22.dll") //full uri, just the name of the dll, nada
or inserting the dll in a user library
or putting the dll as a referenced library in another folder.
It’s really getting me into the nerves.
How to workaround this error? JNI?
SOLUTION
Ok, here’s the solution to this problem. The thing is that inside the jar no dll nor whatsoever folder with files gets packaged in the jar. So just about every dll, folder with images or whatever must be in the folder next to where the runnable jar is. The only thing that gets packed in the jar are the external jars and your .java files to run your software.
Anyway, with Firebird embedded mode it’s quite tricky. Since the jaybird(SOME_VERSION).dll must be placed next to all the .dll, .msg files. But the JVM will demand that the jaybird dll to be in the java.library.path, which of course it’s just system32 and some java folders not related to the program.
So, for your program to detect your runnable jar folder as a java.library.path (Which really should be called paths) where the jaybird dll files and the other firebird files and folders are you put these LOC’s in the main method:
I concant the previous directories for the library paths, since Im just adding it to the list.
Notice that these LOC’s must be before ANY CODE, and that also includes calling the constructor. Beware if you’re using global static modules or JNI invocations.
I hope this saves someone time, I’ve lost 12 hours of my job trying to figure out this properly.
I’d really appreciate if admins don’t erase my edit or this question self answered.
Happy coding =D