JNA native support (/com/sun/jna/linux-arm/libjnidispatch.so) not found in resource path

前端 未结 5 1208
北海茫月
北海茫月 2021-01-02 19:16

I have started to build a java service which incorporates JNA to load a native C/C++ lib and i want to run the java service on the Raspberry PI aka arm platform. I have succ

相关标签:
5条回答
  • 2021-01-02 19:33

    I am re-compiling Apache Spark for RPI2 and I've spent a couple of days to fix the issue. Then I've found the easiest possible solution. All you need to have is a libjnidispatch.so link in your default JVM's native lib path.

    sudo -s ln -s /usr/lib/arm-linux-gnueabihf/jni/libjnidispatch.so /usr/lib/jvm/default-java/jre/lib/arm/libjnidispatch.so
    
    0 讨论(0)
  • 2021-01-02 19:40

    Where is libjnidispatch.so on your system? If it's not on your system, JNA will attempt to unpack it from jna.jar from the indicated resource path. If it's not there either, you'll get the UnsatisfiedLinkError.

    It's recommended that you explicitly install libjnidispatch.so on your system where possible; the jna.jar bundling is mostly there to facilitate usage on the more common desktop platforms.

    linux-arm.jar contains the most recent build of libjnidispatch.so, but only WebStart knows how to automatically load the native from a jar like that. If you unpack it into /opt/lib/jna (or elsewhere on LD_LIBRARY_PATH), you should avoid the link error.

    0 讨论(0)
  • 2021-01-02 19:42

    I'd say its more of "glitch of configuration of the location for the "libjnidispatch.so" in the OS your using or that particular JRE systems internal folder/package/JNDI-structure, it may not be an identically laid out Debian or Java JRE.

    0 讨论(0)
  • 2021-01-02 19:45

    I do the following:

    1. sudo apt-get install libjna-java
    2. get the installed jar /usr/share/java/jna.jar
    3. Install jna.jar as a maven dependency

    They worked to me...

    0 讨论(0)
  • 2021-01-02 19:48

    I packaged the new jna.jar (4.0) and it includes the linux-arm/libjnidispatch.so. The code I was trying to run now works.

    0 讨论(0)
提交回复
热议问题