Skip to main content

JNLPAppletlauncher Issue

2 replies [Last post]
turks
Offline
Joined: 2007-12-23

Hi,
We are using JNLPAppletlauncher to download a dll along with our bridge dll which acts
as the bridge to the methods in the main dll. The bridge methods are called from java.
We are using JNA to load the bridge dll and we get an UnsatisfiedLinkError. This error is
due to fact that tha main dll is a dependency of the bridge dll, but for some reason the
main dll cannot be located.

The exception is Exception in thread "Thread-27" java.lang.UnsatisfiedLinkError:
Unable to load library C:\Users\Me\AppData\Local\Temp\jnlp-applet\jln12362\jln12364\bridge.dll': The specified module could not be found.

Now both the bridge dll AND the main dll are in the folder C:\Users\Me\AppData\Local\Temp\jnlp-applet\jln12362\jln12364.
The reason I know the error is based on finding the dependecy (main.dll) is because if I put a copy on main.dll in a location in the Windows Path (%PATH%), then everything runs fine.
I would just copy the main dll into C:\Windows\System32 and be done with it, but because this is Vista, I get the following exception during the copy :

java.io.IOException: Access is denied
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(Unknown Source)

Can anyone offer any help here, it seems as if the call to load library in JNA finds the bridge.dll but from there you are now in native space (Windows process space) and
the dependecy dll can only be found in the Windows Path and not the java.library.path.

There are no other dependencies, as evidence by my putting a copy of just main.dll
into a location in the Windows Path.

Thanks in advance.
-T

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
twalljava
Offline
Joined: 2004-07-26

More recent versions of JNA (3.0.7 and later) have improved loading of dlls. Dependent dlls will be found if they are in the same directory as one being explicitly loaded.

Unfortunately, there's no guarantee that web start will put all downloaded dlls in the same directory.

kbr
Offline
Joined: 2003-06-16

This is a limitation of the library loading mechanism. You need to manually load the dependent DLLs first. Take a look at the JOGL and JOAL source code on java.net and the use of the NativeLibLoader in a few places which provides helpers for doing this in a portable fashion.