Exception in thread "main" java.lang.UnsatisfiedLinkError: Method Name

Discussion in 'Java' started by newage, Dec 5, 2010.

  1. newage

    newage

    Joined:
    Dec 5, 2010
    Messages:
    1
    Hello.
    Please help me !!! :(
    --------------------------------------------------------------------------
    I have a DLL and it used two ways in Java :

    DLL : HelloWorldImpl.dll
    OS : Windows 2003
    java version : 1.5.0_08
    javac version : 1.5.0_08

    Method 1: folder TEST1
    Two file names are Main.java HelloWorld.java and that includes the following code:

    HelloWorld.java
    Code:
    public class HelloWorld
    {
      public native void displayHelloWorld();
      static
      {
        System.loadLibrary("HelloWorldImpl");
      }
    }
    
    Main.java
    Code:
    public class Main 
    {
      public static void main(String[] args)
      {
        HelloWorld hw = new HelloWorld();
        hw.displayHelloWorld();
      }
    }
    
    When the command I run java Main output below shows the correct implementation of the program suggests.
    Code:
    Hello world!
    Method 2: folder TEST2
    HelloWorld.java the folder name is MyDll which includes the following code:

    HelloWorld.java
    Code:
    package MyDll;
    public class HelloWorld
    {
      public native void displayHelloWorld();
      static
      {
        System.loadLibrary("HelloWorldImpl");
      }
    }
    
    TEST2 folder includes:
    MyDll folder and file Main.java

    Main.java
    Code:
    import MyDll.*;
    public class Main 
    {
      public static void main(String[] args)
      {
        HelloWorld hw = new HelloWorld();
        hw.displayHelloWorld();
      }
    }
    
    When the command I run java Main shows the following error.
    Code:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: displayHelloWorld
            at MyDll.HelloWorld.displayHelloWorld (Native Method)
            at Main.main (Main.java: 7)
     
    Last edited: Dec 5, 2010
    newage, Dec 5, 2010
    #1
    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. JPractitioner
    Replies:
    4
    Views:
    19,036
    Roedy Green
    Mar 31, 2006
  3. andrej.frelih@gmail.com

    java.lang.UnsatisfiedLinkError - native method

    andrej.frelih@gmail.com, Nov 13, 2007, in forum: Java
    Replies:
    1
    Views:
    4,569
    Roedy Green
    Nov 13, 2007
  4. debapriya.patra
    Replies:
    0
    Views:
    1,040
    debapriya.patra
    Mar 18, 2009
  5. morpheous.sigma@gmail.com
    Replies:
    2
    Views:
    485
Loading...

Share This Page