Public: Technology Reviews : JNI Info
This page last changed on May 03, 2007 by scytacki.
For example you have a file ccsensor.dll and it needs GoIO.dll. The GoIO.dll is not a JNI library it is a library uised by ccsensor.dll.
On windows you can simply put both libraries in the java.library.path and then call loadLibray() on each one in the correct order. In this case that order is GoIO.dll first, and then the ccsensor.dll.
This works with webstart too. If you put both dlls in a jar and then use the <nativelib> tag of webstart you can call loadLibrary() and it works.
On OS X these files would be called: libccsensor.jnilib and libGoIO.dylib.
The best way to make this work is to create a application bundle. Then the reference from the jnilib to the dylib can be made relative to the bundle. This is done by setting the "install_name". (links??)
Alternatively, you can export the DYLD_LIBRARY_PATH variable and set it to a directory where the dylib is then the library can be found.
My conclusion is that it is not possible using the nativelib mechanism of webstart. I believe this should be a bug. There should be a way to load these type of dependencies through webstart on a os x. Perhaps a special install_name, or extacting the libraries to a tmp directory and setting DYLD_.. to point to that directory.
So there are few hacks:
There is a good general page about OS X JNI here:
Here is a good page about dynamic library linking in OSX:
This page alludes to the fact that it works with webstart, but It isn't clear they tried it on os x:
Calling loadLibrary on the libGoIO.dylib does not work because it doesn't end with jnilib.
Two types of errors seem to indicate if the jnilib is a bundle or dylib:
When the ccsensor is loaded it crashes the vm because it can't find the GoIO dependency.
|Document generated by Confluence on Jan 27, 2014 16:56|