I have a problem creating a simple Java Application that uses JNI to load a dll that prints the mesage “Passing string from Java”.
i have wriiten a simple code :
public class TESTJNI
native void showMessage( String str);
System.out.println( "In the constructor of the java program" );
public static void main( String s )
TESTJNI JNT = new TESTJNI();
JNT.showMessage("Passing string from Java");
Exception in thread "main" java.lang.UnsatisfiedLinkError
Where is the library stored?
According to the API specs of load, "The filename argument must be a complete path name"
I tried with complete pathname, still that error occured......
You should use System.loadLibrary
Here is an example that you should read: Chapter 5 Continued: JNI Example
When i tried with complete pathname where dll load... System.loadLibrary("D:\\JNITEST\\JNITEST\\src\\jni test\\jnitest.dll");
the error is "Could not find the main class.Programm will exit ".
also tried with System.loadLibrary("jnitest");
Exception in thread "main" java.lang.UnsatisfiedLinkError (same error).
k i will try....thanks.....
if you are using complete path use this
try this blog for basic java jni Basic Java JNI | j4guiang.blogspot.com