java - UnsatisfiedLinkError in exported (Eclipse) executable jar file -


the code works fine when executing eclipse. i'm using opencv 2.4.11 , javafx ui. when export executable jar eclipse , run cmd following exception:

enter image description here

i followed many post here on , opencv forum(1, 2, 3, 4) but, none of answers seems me.

i have added opencv jar library , native library linked /build/java/x64 suggested in answers.

java build path

the exception occurs @ system.loadlibrary(core.native_library_name), checked native_library_name , opencv version same 1 imported in project.

public class customframe extends application{      @override     public void start(stage primarystage){         group root = new group();         canvas canvas = new canvas(1440, 840);          imageview imageview = new imageview();         imageview.setfitheight(canvas.getheight());         imageview.setfitwidth(canvas.getwidth());         new framecontroller().startcamera(imageview);          root.getchildren().addall(imageview, canvas);         primarystage.setscene(new scene(root));         primarystage.show();     }      public static void main(string[] args)     {         // load native opencv library         system.loadlibrary(core.native_library_name);         launch(args);     } } 

if thinks have missed please let me know.

the unsatisfiedlinkerror thrown when application attempts load native library like

  1. .so in linux,
  2. .dll on windows or
  3. .dylib in mac

and that library not exist.

specifically, in order find required native library, jvm looks in both path environment variable , java.library.path system property.

sometimes if native library loaded application , same application tries load again, can cause error also.


how deal unsatisfiedlinkerror?

first of must verify parameter passed in system.loadlibrary method correct , library exists. notice extension of library not required. thus, if library named samplelibrary.dll, must pass samplelibrary value parameter.

moreover, in case library loaded application , application tries load again, unsatisfiedlinkerror thrown jvm. also, must verify native library present either in java.library.path or in path environment library of application. if library still cannot found, try provide absolute path system.loadlibrary method.

in order execute application, use -djava.library.path argument, explicitly specify native library. example, using terminal (linux or mac) or command prompt (windows), execute application issuing following command:

java -djava.library.path= "<path_of_your_application>" –jar <applicationjar.jar> 

you have missed actual command. use following

java -djava.library.path="c:\opencv2.1.11\opencv\build\java\x64" -jar blurdetector.jar 

or

java -djava.library.path="c:\opencv2.1.11\opencv\build\java" -jar blurdetector.jar 

instead of command

java -djava.library.path="c:\users\vivek_elango\desktop" -jar blurdetector.jar // have given wrong path of application 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -