Running within a servlet container is a different question entirely.
I think most folks who have done so have loaded JNA in a singleton
instance separate from the servlet so that they don't have to worry
about loading and unloading the native library, which can be
problematic to do reliably.
That makes totally sense, so I tried it out this weekend, as well as
adding some static here and there.. but no luck, loading goes well but
I
get no results. So looking further found some info pointing various
notes regarding tomcat and dlls (out of scope of this list I guess),
which I tried it but in all tests I got the UnsatisfiedLinkError. I
tried adding a System.loadLibrary and
then the Native.loadLibrary didn't throw any error, but then I got no
results again.
Moreover, bad for me because when I told you I successfully could make
work the DLL in a java console app, I ONLY tried
it with the required dlls inside the main app dir. So this weekend I
tried the console app with the dlls outside in another dir,
and UnsatisfiedLinkError appeared. In this case, I managed to get it
work doing several things (setting the java.library.path and/or the
jna.library.path, putting DLL's in one of the PATH dirs...), and the
error persisted.
So up to this point in my mind I have two paths and one confusing
point. Confused because after searching the lists and the doc I don't
know for sure
if the dependent dlls get loaded without my intervention, just loading
the main dll; how's it really?. And for both ways, or I'm loosing some
essential point
- like class and library paths concepts - , or one of the dependent
dlls named MSVCRT is presenting conflicts, as it's a common windows
dll,
tho it seems its not the one being loaded by the main dll, could it be?
Thank you in advance,
Xavier