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

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

问题描述

我已经开始构建一个java服务,它包含JNA以加载本机C / C ++库,我想在Raspberry PI aka arm平台上运行java服务。我已经成功建立了稳定的服务基础,它在Windows7和linux-amd64 / debian上运行,但是在RPI平台上我得到了上述错误:
线程mainjava.lang中的异常。 UnsatisfiedLinkError:在资源路径中找不到JNA本机支持(/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 hard float。
*已安装的libjna-java lib。

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

CLASSPATH

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 ,我花了几天时间来解决这个问题。然后我找到了最简单的解决方案。您需要拥有的是默认JVM的本机lib路径中的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天全站免登陆