A dll has to be in the one of the following places a) folders java.library.path, b) the folder the application is running from, c) current folder.
If you are running an
applet under IE,
a = folders listed in PATH environment variable
b = the folder where IEExplore.exe is running
c = I don't know
If you want your applet to access a dll, you have to either put the dll in Windows-system, OR install the dll somewhere on the local system and add the path to the dll in the environment variable
If you are running an application
a = folders listed in -Djava.library.path command line option. I think this defaults to the PATH environment variable
b = jre-bin folder
c = folder where the user starts the application from
So, for your application to access a dll, you have to either put the dll in Windows-system, OR install the dll somewhere on the local system and add the path to the dll in the environment variable, OR put the dll in jre-bin OR always start your application from a specific folder, and place the dll in that folder
AFAIK, there is no way you can load a dll from the jar.
I don't know if you can rig up your own classloader that loads the dll from inside the jar, and places it in jre-bin or something. I have never tried it myself. You might want to look into extending the ClassLoader if you are really interested
Here's a
thread in
Java forums that you might find interesting