Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JNI java.lang.UnsatisfiedLinkError with found DLL

Reply
Thread Tools

JNI java.lang.UnsatisfiedLinkError with found DLL

 
 
=?iso-8859-1?q?J=F6rgen_Persson?=
Guest
Posts: n/a
 
      04-11-2006
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.jav a: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

 
Reply With Quote
 
 
 
 
Chris Uppal
Guest
Posts: n/a
 
      04-11-2006
Jörgen Persson wrote:

> 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


 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      04-11-2006
On 11 Apr 2006 07:16:56 -0700, "Jörgen Persson" <(E-Mail Removed)>
wrote, quoted or indirectly quoted someone who said :

>
>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.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      04-11-2006
On 11 Apr 2006 07:16:56 -0700, "Jörgen Persson" <(E-Mail Removed)>
wrote, quoted or indirectly quoted someone who said :

>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.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
=?iso-8859-1?q?J=F6rgen_Persson?=
Guest
Posts: n/a
 
      04-12-2006
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

 
Reply With Quote
 
craned craned is offline
Junior Member
Join Date: Aug 2012
Posts: 1
 
      08-02-2012
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Second long argument to a JNI call on a Win32 DLL contains zero when it reaches the DLL pcarr01 Java 3 02-17-2005 09:30 AM
Re: JNI: Error loading DLL from JNI DDL vasanth Java 0 01-25-2005 11:03 AM
Re: JNI: Error loading DLL from JNI DDL vasanth Java 0 01-25-2005 11:01 AM
IBM's JNI fails where Sun's JNI works Alex Hunsley Java 4 11-04-2003 10:34 AM
msvcrt.dll, msvcirt.dll, msvcrt20.dll and msvcrt40.dll, explanation please! Snoopy NZ Computing 16 08-25-2003 12:34 PM



Advertisments