简体   繁体   English

在资源路径中找不到 JNA 原生支持 (/com/sun/jna/linux-arm/libjnidispatch.so)

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

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.我已经开始构建一个 Java 服务,它结合了 JNA 来加载本机 C/C++ 库,我想在 Raspberry PI aka arm 平台上运行 Java 服务。 I have successfully built a stable ground of the service and it runs on both Windows7 and linux-amd64/debian but.. on the RPI platform i get the above stated error: Exception in thread "main" java.lang.UnsatisfiedLinkError: JNA native support (/com/sun/jna/linux-arm/libjnidispatch.so) not found in resource path我已经成功地建立了一个稳定的服务基础,它可以在 Windows7 和 linux-amd64/debian 上运行,但是在 RPI 平台上我得到了上述错误:线程“main”中的异常 java.lang.UnsatisfiedLinkError: JNA native在资源路径中找不到支持 (/com/sun/jna/linux-arm/libjnidispatch.so)

On the RPI i have done the following: * Installed both openjdk7 and java8 beta with arm hard float support.在 RPI 上,我完成了以下操作: * 安装了 openjdk7 和 java8 beta 并支持 arm 硬浮动。 * Installed libjna-java lib. * 安装了 libjna-java 库。

Following are set:设置如下:

Java爪哇

root@pisces:/opt/TellstickReplay# java -version
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b36e)
Java HotSpot(TM) Client VM (build 25.0-b04, mixed mode)
root@pisces:/opt/TellstickReplay#

LD_LIBRARY_PATH LD_LIBRARY_PATH

root@pisces:/opt/TellstickReplay# echo $LD_LIBRARY_PATH
/opt/lib/jna

CLASSPATH类路径

root@pisces:/opt/TellstickReplay# echo $CLASSPATH
/usr/lib/jna

None of the settings seems to satisfy JAVA with JNA support.这些设置似乎都不能满足具有 JNA 支持的 JAVA。 I have even tried to export both jna.jar and linux-arm.jar into the project in Eclipse and all together rebuild the jars into the exported jar still getting the same error.我什至尝试将 jna.jar 和 linux-arm.jar 都导出到 Eclipse 中的项目中,然后一起将 jar 重新构建到导出的 jar 中,但仍然出现相同的错误。 The exported jar has been tested successfully on both windows and linux so the jar file is working.导出的 jar 已在 windows 和 linux 上成功测试,因此 jar 文件正在运行。

I have also tried to just use CLASSPATH in the Manifest in the jar file but with no success.我也尝试在 jar 文件的 Manifest 中使用 CLASSPATH 但没有成功。 I have also tried to explicitly load the libjnidispatch.so from the absolute path but JAVA then starts to complain that it cannot find the file to libjnidispatch.so even that the path is 100% correct.我还尝试从绝对路径显式加载 libjnidispatch.so,但 JAVA 开始抱怨它找不到 libjnidispatch.so 的文件,即使路径是 100% 正确的。

So.. does anyone know HOW to correctly get JNA support on the Raspberry PI platform to work??那么.. 有谁知道如何在 Raspberry PI 平台上正确获得 JNA 支持? Please, im getting tremendously frustrated and soon giving up hope to fix this..拜托,我感到非常沮丧,很快就放弃了解决这个问题的希望。

Where is libjnidispatch.so on your system?您系统上的 libjnidispatch.so 在哪里? If it's not on your system, JNA will attempt to unpack it from jna.jar from the indicated resource path.如果它不在您的系统上,JNA 将尝试从指定资源路径的 jna.jar 中解压它。 If it's not there either, you'll get the UnsatisfiedLinkError .如果它也不存在,您将收到UnsatisfiedLinkError

It's recommended that you explicitly install libjnidispatch.so on your system where possible;建议您尽可能在系统上显式安装 libjnidispatch.so; the jna.jar bundling is mostly there to facilitate usage on the more common desktop platforms. jna.jar 捆绑主要是为了方便在更常见的桌面平台上使用。

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. linux-arm.jar包含linux-arm.jar的最新版本,但只有 WebStart 知道如何从这样的 jar 中自动加载本机。 If you unpack it into /opt/lib/jna (or elsewhere on LD_LIBRARY_PATH), you should avoid the link error.如果将其解压到 /opt/lib/jna(或 LD_LIBRARY_PATH 上的其他位置),则应避免链接错误。

I am re-compiling Apache Spark for RPI2 and I've spent a couple of days to fix the issue.我正在为 RPI2 重新编译Apache Spark ,我花了几天时间来解决这个问题。 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.您所需要的只是默认 JVM 的本机库路径中的 libjnidispatch.so 链接。

sudo -s ln -s /usr/lib/arm-linux-gnueabihf/jni/libjnidispatch.so /usr/lib/jvm/default-java/jre/lib/arm/libjnidispatch.so

I packaged the new jna.jar (4.0) and it includes the linux-arm/libjnidispatch.so.我打包了新的 jna.jar (4.0),它包含了 linux-arm/libjnidispatch.so。 The code I was trying to run now works.我试图运行的代码现在可以工作了。

我想说的更多是您使用的操作系统或特定 JRE 系统内部文件夹/包/JNDI 结构中“libjnidispatch.so”位置的“配置故障”,它可能不是布局相同的 Debian 或爪哇JRE。

I do the following:我执行以下操作:

  1. sudo apt-get install libjna-java须藤 apt-get 安装 libjna-java
  2. get the installed jar /usr/share/java/jna.jar获取已安装的 jar /usr/share/java/jna.jar
  3. Install jna.jar as a maven dependency安装 jna.jar 作为 maven 依赖

They worked to me...他们为我工作...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 com / sun / jna / android-arm / libjnidispatch.so在资源路径中找不到 - com/sun/jna/android-arm/libjnidispatch.so not found in resource path 在资源路径中找不到本机库(com / sun / jna / android-aarch64 / libjnidispatch.so) - Native library (com/sun/jna/android-aarch64/libjnidispatch.so) not found in resource path UnsatisfiedLinkError:在资源路径 (.) 中找不到本机库 (com/sun/jna/android-x86-64/libjnidispatch.so) - UnsatisfiedLinkError: Native library (com/sun/jna/android-x86-64/libjnidispatch.so) not found in resource path (.) android-arm/libjnidispatch.so 未找到错误 - android-arm/libjnidispatch.so not found error 尝试在Mac OS X上加载JNA库时出现“无法加载库:在资源路径中找不到JNA本机支持” - “Unable to load library: JNA native support not found in resource path” on trying to load JNA library on Mac OS X 未找到 JNA。 本机方法将被禁用。 java.lang.ClassNotFoundException: com.sun.jna.Native - JNA not found. native methods will be disabled. java.lang.ClassNotFoundException: com.sun.jna.Native 在资源路径中找不到线程“主” java.lang.UnsatisfiedLinkError中的异常:jnidispatch(/ com / sun /jna/win32-x86/jnidispatch.dll) - Exception in thread “main” java.lang.UnsatisfiedLinkError: jnidispatch (/com/sun /jna/win32-x86/jnidispatch.dll) not found in resource path Cassandra 无法初始化 class com.sun.jna.Native - Cassandra Could not initialize class com.sun.jna.Native ARM64机器上的Cassandra启动失败(java.lang.NoClassDefFoundError:无法初始化类com.sun.jna.Native) - Cassandra Startup failure on ARM64 machine (java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native) JNA - 设置资源路径 - JNA - Set resource Path
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM