I'm using the JNA's com.sun.jna.NativeLibrary
class in order to load the VLCJ
native library. I'm working on an armv8(aarch x64)-based linux device
. Below is my code, note that i am using the latest JNA version jna-4.5.2
:
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), Constants.DEPLIB_OUTPUT_DIRECTORY);
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
LibXUtil.initialise();
First i was getting this error:
java.lang.UnsatisfiedLinkError: JNA native support (com/sun/jna/linux-aarch64/libjnidispatch.so) not found in resource path
After a quick search i found that i must copy the jna native lib directory from inside the jar into the jvm lib path, where the jna jar library has pre-built libraries for almost all known systems as shown in the image below:
jna-4.5.2 internal content.jpeg
After doing that, the above exception disappeared but another one came up:
java.lang.UnsatisfiedLinkError: Can't obtain static method fromNative(Method, Object) from class com.sun.jna.Native
the exception is saying that it couldn't find the method fromNative(Method, Object) in the class com.sun.jna.Native however after decompiling this class i found that the method already exists.
I'm out of ideas know, any help would be highly appreiated, thanks!.
solve by:
After a quick search i found that i must copy the
jna
native lib directory from inside the jar into thejvm
lib path...
jna
modules (jars) from my projectjna.jar
jna-platform.jar
linux-aarch64.jar