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

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -