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
Main.java
When the command I run java Main output below shows the correct implementation of the program suggests.
Method 2: folder TEST2
HelloWorld.java the folder name is MyDll which includes the following code:
HelloWorld.java
TEST2 folder includes:
MyDll folder and file Main.java
Main.java
When the command I run java Main shows the following error.
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");
}
}
Code:
public class Main
{
public static void main(String[] args)
{
HelloWorld hw = new HelloWorld();
hw.displayHelloWorld();
}
}
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();
}
}
Code:
Exception in thread "main" java.lang.UnsatisfiedLinkError: displayHelloWorld
at MyDll.HelloWorld.displayHelloWorld (Native Method)
at Main.main (Main.java: 7)
Last edited: