Java JNA UnsatisfiedLinkError -


i following tutorial : http://stuf.ro/calling-c-code-from-java-using-jna . difference class called main.c not ctest.c. i've created library inside project folder says there. on next step created java file line modified :

ctest ctest = (ctest) native.loadlibrary("ctest", ctest.class); 

to

ctest ctest = (ctest) native.loadlibrary("main", ctest.class); 

i have imported jna-4.1.0.jar project. on run gives me error :

exception in thread "main" java.lang.unsatisfiedlinkerror: unable load library 'main': native library (win32-x86-64/main.dll) not found in resource path ([file:/d:/eclipse/workspace/rxtx/bin/, file:/d:/eclipse/workspace/rxtx/lib/rxtxcomm.jar, file:/c:/users/angelo/downloads/jna-4.1.0.jar])     @ com.sun.jna.nativelibrary.loadlibrary(nativelibrary.java:271)     @ com.sun.jna.nativelibrary.getinstance(nativelibrary.java:398)     @ com.sun.jna.library$handler.<init>(library.java:147)     @ com.sun.jna.native.loadlibrary(native.java:412)     @ com.sun.jna.native.loadlibrary(native.java:391)     @ helloworld.main(helloworld.java:9) 

where place main.c , do libctest.so file ?

if build library libctest.sothen need load ctest ctest = (ctest) native.loadlibrary("ctest", ctest.class); (assuming rest of setup correct).

where place library described in javadoc of class native.

to hints might print steps of jna library search console.

system.setproperty("jna.debug_load", "true")); ctest ctest = (ctest) native.loadlibrary("ctest", ctest.class); 

edit

how call class (amend classpath , directory name)

java -classpath jna.jar:. -djna.library.path=/your/path/to/the/libctest/file helloworld 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -