Subject | Re: [Firebird-Java] JayBird and FireBird locations |
---|---|
Author | Roman Rokytskyy |
Post date | 2009-09-29T19:31:42Z |
> Relying on environment variables is risky.You can create a batch file that sets the variables and runs Java.
>
> What if the end-user who installs our application has already installed a
> version of Firebird different from the version the application was tested
> with? I want the app to use the version of Firebird it was tested against
> without affecting end-user working environment.
Alternatively, if you not want to have batch files, you create a small
.exe that loads the JVM and executes the main method of your class. You,
then, have full control over the environment of the process
(SetEnvironmentVariable function from Kernel32 library). Such
application would need max 500 lines in C++.
> I gave up on keeping Firebird DLLs separate and copied all of them to theCopy all DLLs to %JAVA_HOME%/bin, should also work. But that is not the
> working directory. But even then the app won't work without having the
> FIREBIRD environment variable set to point to the working directory. Any
> ideas?
answer you would like to hear, I guess :)
As I said, Firebird Embedded is not very friendly with Java because the
primary target are Delphi and, possibly, .NET users who use this type of
server extensively.
The fbembed.dll loading mechanism was discussed several times among
developers, one of the main requirements is that it should run when
Firebird Embedded is copied to the same directory where the .exe is
located (requirement from Delphi users - ease of use).
Then we have Java, where the process that loads the library is not
located in the working directory. In this case we have the FIREBIRD env
variable. Merging fbembed.dll with jaybirdXX.dll to make it loadable
directly from Java is not acceptable for the Firebird project due to
dependency on JDK (and you would need to statically link the ICU libs as
well), though it is thinkable.
If I were you and was creating a redistributable _desktop_ Java
application (admins on server will be able to deal with environment
variables), I would either use batch files or created that loader
process for the target platform.
Roman