java.lang.UnsatisfiedLinkError using jni -
class helloworld { public native void print(); //native method static //static initializer code { try{ string path = system.getproperty("java.library.path"); system.out.println(path); system.loadlibrary("clibhelloworld1"); //system.load("c:/te_cda_project/test/native/clibhelloworld1.dll"); //runtime.getruntime().load("c:/te_cda_project/test/native/clibhelloworld1.dll"); system.out.println("loaded callapi"); }catch(unsatisfiedlinkerror e){ e.printstacktrace(); } } public static void main(string[] args) { helloworld hw = new helloworld(); hw.print(); } }
output:
c:\te_cda_project\test\native loaded callapi exception in thread "main" java.lang.unsatisfiedlinkerror: graph.helloworld.print()v @ graph.helloworld.print(native method) @ graph.helloworld.main(helloworld.java:26)
add c compiler additional options worked me:
-wl,--export-all-symbols -wl,--add-stdcall-alias
Comments
Post a Comment