java.lang.UnsatisfiedLinkError

Discussion in 'Java' started by ba.hons, Sep 18, 2006.

  1. ba.hons

    ba.hons Guest

    Hello,

    i am using some classes which were written to be executed by a web
    service and am trying to use them in a test application which will use
    a simple main method.

    the class am trying to use has a

    System.loadLibrary("thedll");

    and then has a number of native methods which i asume are all stored
    within "thedll"

    each time i attempt to execute any the native methods i get:

    Exception in thread "main" java.lang.UnsatisfiedLinkError:
    theMethodAmCalling

    i have tried using dependencywalker application make sure i have all
    the dependent dll's and from what i can see they are all stored in my
    system32 directory, i have made sure my PATH variable has this
    directory as well so it isnt that, and anyway it doesnt through an IO
    error so it must actually find the dll.

    ANY IDEAS would be really great

    thanks in advance

    ADAM
    ba.hons, Sep 18, 2006
    #1
    1. Advertising

  2. On 18 Sep 2006 12:33:38 -0700, ba.hons wrote:
    > each time i attempt to execute any the native methods i get:
    >
    > Exception in thread "main" java.lang.UnsatisfiedLinkError:
    > theMethodAmCalling


    Just to confirm: you get no exception when you load the DLL, you get
    the exception when you attempt to invoke one of the methods?

    If that's the case, then the JVM is unable to find the methods it
    expects to find in the DLL.

    Note that the DLL was necessarily written to be used from a particular
    Java class. That class declares a number of native methods, and the
    DLL contains implementations of those methods. You cannot load the
    same DLL from another class and expect to be able to use those methods
    as though they belonged to the new class, because the method names in
    the DLL are determined (in part) by the name of the class they belong
    to.

    Did you rename the class the dll was intended to be used from? Did you
    change its package declaration?

    If any of this is unclear to you, then post some real code (not just
    an abstract example).

    /gordon

    --
    [ don't email me support questions or followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Gordon Beaton, Sep 18, 2006
    #2
    1. Advertising

  3. ba.hons

    ba.hons Guest

    YOUR A STAR !!!

    i had changed the package name and that was causing the problem, really
    thanks for the help i think i would have been here all night !!

    Adam
    ba.hons, Sep 18, 2006
    #3
  4. ba.hons

    debapriya.patra

    Joined:
    Mar 18, 2009
    Messages:
    3
    Exception in thread "main" java.lang.UnsatisfiedLinkError: <method name>

    Hi ,
    I am facing problem when i am trying to call the native method from the dll.
    Its loading the dll, but when i am calling the native method its throwing the error called ::

    Exception in thread "main" java.lang.UnsatisfiedLinkError: display


    This is my code where i am calling the native method::

    package delfigo;

    /**
    * @author Debapriya.Patra
    *
    */
    public class JNIInvocation {
    public native int display();

    static {
    System.loadLibrary("delfigo");
    }

    /**
    * @param args
    */
    public static void main(String[] args) {
    // Call C++ method
    JNIInvocation lInvocation = new JNIInvocation();
    lInvocation.display();
    }

    }



    can anybody help me on this...

    thnx in advance..

    Regard,
    deba:-(
    debapriya.patra, Mar 18, 2009
    #4
    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,788
    Lorin Hochstein
    Mar 5, 2004
  2. Fahad
    Replies:
    1
    Views:
    537
    Roedy Green
    Jul 1, 2005
  3. Replies:
    1
    Views:
    2,373
    Roedy Green
    Sep 15, 2005
  4. TsanChung
    Replies:
    0
    Views:
    1,436
    TsanChung
    Sep 4, 2008
  5. TsanChung
    Replies:
    8
    Views:
    3,077
    anandmadhab
    Sep 30, 2011
Loading...

Share This Page