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

Joined
Dec 5, 2010
Messages
1
Reaction score
0
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:

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top