Hi
I have made a C++ DLL, which I load like this:
static {
System.loadLibrary("LicenseWrapper");
}
I have added the location of the DLL to the windows PATH.
On windows XP this works fine and I get expected results.
On windows 2003 I get :
Exception in thread "main" java.lang.UnsatisfiedLinkError:
C:\license\LicenseWrapper.dll: This application has failed to start
because the application configuration is incorrect. Reinstalling the
application may fix this problem
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1843)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1729)
at java.lang.Runtime.loadLibrary0(Runtime.java:780)
at java.lang.System.loadLibrary(System.java:865)
This error is not because it cannot find the DLL, which I have verified
by renaming it, there is something else.
The DLL is created in a Win32 Project using Microsoft Visual Studio
2005.
Are there windows version considurations when creating a DLL for JNI?
Best regards,
Jörgen
Chris Uppal - 11 Apr 2006 16:51 GMT
> On windows XP this works fine and I get expected results.
> On windows 2003 I get :
[quoted text clipped - 6 lines]
> This error is not because it cannot find the DLL, which I have verified
> by renaming it, there is something else.
This is a bit of a wild guess: does your DLL require a version of another DLL
which is not present on the 2003 machine ? For instance it might require a
specific version of the MS VC runtime library which I believe they are now
giviing a different name to on each release.
Dependency Walker should help you confirm or refute this suggestion.
http://www.dependencywalker.com/
-- chris
Roedy Green - 11 Apr 2006 20:33 GMT
>This error is not because it cannot find the DLL, which I have verified
>by renaming it, there is something else.
[quoted text clipped - 3 lines]
>
>Are there windows version considurations when creating a DLL for JNI?
is the DLL binary the identical in both cases?
Keep in mind case sensitivity. I suggest renaming the dll to all
lower case. all the way through, not just the final file.
In a pinch try load vs loadlibrary. Screwy stuff going way back
happened I never could figure out meant one would work but not the
other.
See the gotchas at http://mindprod.com/jgloss/jni.html#LOADLIBRARY
In a pinch, you can use JAWS and put the DLL in the jar.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Roedy Green - 11 Apr 2006 20:34 GMT
>Exception in thread "main" java.lang.UnsatisfiedLinkError:
>C:\license\LicenseWrapper.dll: This application has failed to start
>because the application configuration is incorrect. Reinstalling the
>application may fix this problem
When you create your DLL, create it as a static library, so that it
will be self contained and not depend on various other libraries being
preinstalled.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Jörgen Persson - 12 Apr 2006 09:48 GMT
Thank you for your responses!
It turns out that when I create the DLL Win32 project and check the
options ATL and MFC header files it all worked fine. I am a Java
programmer so someone else needs to explain way ... :-)
Jörgen