JNI java.lang.UnsatisfiedLinkError with found DLL

Discussion in 'Java' started by =?iso-8859-1?q?J=F6rgen_Persson?=, Apr 11, 2006.

  1. 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
     
    =?iso-8859-1?q?J=F6rgen_Persson?=, Apr 11, 2006
    #1
    1. Advertising

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

    Chris Uppal Guest

    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
     
    Chris Uppal, Apr 11, 2006
    #2
    1. Advertising

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

    Roedy Green Guest

    On 11 Apr 2006 07:16:56 -0700, "Jörgen Persson" <>
    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.
     
    Roedy Green, Apr 11, 2006
    #3
  4. =?iso-8859-1?q?J=F6rgen_Persson?=

    Roedy Green Guest

    On 11 Apr 2006 07:16:56 -0700, "Jörgen Persson" <>
    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.
     
    Roedy Green, Apr 11, 2006
    #4
  5. 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
     
    =?iso-8859-1?q?J=F6rgen_Persson?=, Apr 12, 2006
    #5
  6. =?iso-8859-1?q?J=F6rgen_Persson?=

    craned

    Joined:
    Aug 2, 2012
    Messages:
    1
    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
     
    craned, Aug 2, 2012
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lorin Hochstein
    Replies:
    2
    Views:
    1,811
    Lorin Hochstein
    Mar 5, 2004
  2. shivaraj
    Replies:
    8
    Views:
    35,426
    antan_sw
    Nov 9, 2009
  3. TsanChung
    Replies:
    0
    Views:
    1,469
    TsanChung
    Sep 4, 2008
  4. TsanChung
    Replies:
    8
    Views:
    3,135
    anandmadhab
    Sep 30, 2011
  5. Replies:
    5
    Views:
    1,402
    Roedy Green
    Jun 18, 2012
Loading...

Share This Page