• Post Reply Bookmark Topic Watch Topic
  • New Topic

UnsatisfiedLinkError Exception with JNI

 
Mari Wessels
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I'm not sure why I'm getting this error but this is what I do:
I've got a class HelloWorld with a native method print.
I've got a dll (windows) called HelloWorld that holds the implementation of print:
private native void print(); (Java)
Java_HelloWorld_print(JNIEnv *env, jobject obj)
{
printf("Hello World!\n");
return;
} (C++ method)
In my static loader I load the dll and this successfully complets, but then the exception
Exception in thread "main" java.lang.UnsatisfiedLinkError: print
at JNITut.HelloWorld.print(Native Method)
at JNITut.HelloWorld.main(HelloWorld.java:9)
is thrown when I call
new HelloWorld().print();
Anybody got any ideas? I can't seem to find ppl who have had this problem before.
Mari.
 
Trever Shick
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is your DLL? It needs to be in the search path. You can alter your path:
set PATH=%PATH%;<your dll path>
Then run it...
That should fix the problem
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!