• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

UnsatisfiedLinkError Exception with JNI

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic