JNI java.lang.UnsatisfiedLinkError with found DLL

  • Thread starter =?iso-8859-1?q?J=F6rgen_Persson?=
  • Start date
?

=?iso-8859-1?q?J=F6rgen_Persson?=

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
 
C

Chris Uppal

Jörgen Persson said:
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
[...]
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
 
R

Roedy Green

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?

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.
 
R

Roedy Green

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.
 
?

=?iso-8859-1?q?J=F6rgen_Persson?=

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
 
Joined
Aug 2, 2012
Messages
1
Reaction score
0
I'm having this similar problem on a XP 32-bit system. It's finding the dll in the System32 file, but it says 'This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem'.

I don't know what it takes to fix the app config as I'm fairly new to dll's. I tried removing the dll and putting it back again. Unless the company who provided it to me is the one who needs to fix it, I'm not sure how to even access the app config on this dll.

Thanks,
Devin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top