在资源路径中找不到 JNA 原生支持 (/com/sun/jna/linux-arm/libjnidispatch.so) [英] JNA native support (/com/sun/jna/linux-arm/libjnidispatch.so) not found in resource path

查看:136
本文介绍了在资源路径中找不到 JNA 原生支持 (/com/sun/jna/linux-arm/libjnidispatch.so)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始构建一个 Java 服务,它结合了 JNA 来加载本地 C/C++ 库,我想在 Raspberry PI aka arm 平台上运行 Java 服务.我已经成功地建立了一个稳定的服务基础,它可以在 Windows7 和 linux-amd64/debian 上运行,但是..在 RPI 平台上我得到了上述错误:线程main"中的异常 java.lang.UnsatisfiedLinkError: JNA native support (/com/sun/jna/linux-arm/libjnidispatch.so) 在资源路径中未找到

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 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

在 RPI 上,我完成了以下操作:* 安装了 openjdk7 和 java8 beta 并支持 arm 硬浮动.* 安装了 libjna-java 库.

On the RPI i have done the following: * Installed both openjdk7 and java8 beta with arm hard float support. * Installed libjna-java lib.

设置如下:

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

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

类路径

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

似乎没有一个设置能满足 JAVA 的 JNA 支持.我什至尝试将 jna.jar 和 linux-arm.jar 都导出到 Eclipse 中的项目中,并且一起将 jar 重新构建到导出的 jar 中,但仍然出现相同的错误.导出的 jar 已在 windows 和 linux 上测试成功,因此 jar 文件正在运行.

None of the settings seems to satisfy JAVA with JNA support. 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. The exported jar has been tested successfully on both windows and linux so the jar file is working.

我也尝试在 jar 文件的 Manifest 中使用 CLASSPATH,但没有成功.我还尝试从绝对路径显式加载 libjnidispatch.so,但随后 JAVA 开始抱怨它找不到 libjnidispatch.so 的文件,即使该路径 100% 正确.

I have also tried to just use CLASSPATH in the Manifest in the jar file but with no success. 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.

那么.. 有谁知道如何在 Raspberry PI 平台上正确获得 JNA 支持以使其正常工作?拜托,我感到非常沮丧,很快就放弃了解决这个问题的希望..

So.. does anyone know HOW to correctly get JNA support on the Raspberry PI platform to work?? Please, im getting tremendously frustrated and soon giving up hope to fix this..

推荐答案

我正在重新编译 Apache Spark 对于 RPI2,我花了几天时间来解决这个问题.然后我找到了最简单的解决方案.您所需要的只是默认 JVM 的本机库路径中的 libjnidispatch.so 链接.

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

这篇关于在资源路径中找不到 JNA 原生支持 (/com/sun/jna/linux-arm/libjnidispatch.so)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆