我想在我的树莓派上安装一个 rxtx 包 该包将在 KURA 平台上运行(Equinox 是 Kura 的 OSGi 容器)
我使用以下方法安装了 rxtx native 库: sudo apt-get 安装 librxtx-java
.so 安装在目录:/usr/lib/jni/
pi@raspberrypi /usr/lib/jni $ ls
librxtxI2C-2.2pre1.so librxtxParallel.so librxtxRS485-2.2pre1.so librxtxSerial-2.2pre1.so
librxtxI2C.so librxtxRaw-2.2pre1.so librxtxRS485.so librxtxSerial.so
librxtxParallel-2.2pre1.so librxtxRaw.so
然后我点击此链接将 rxtx 库打包成一个包 http://rxtx.qbang.org/wiki/index.php/Wrapping_RXTX_in_an_Eclipse_Plugin
我在捆绑 list 中添加了这个:
Bundle-NativeCode: /usr/lib/jni/librxtxSerial.so;osname="Linux";processor="armv6l"
因为我的操作系统类型是 linux,我的架构是 ARM:
pi@raspberrypi ~ $ cat /proc/sys/kernel/{ostype,osrelease,version}
Linux
3.18.11+
#781 PREEMPT Tue Apr 21 18:02:18 BST 2015
pi@raspberrypi ~ $ arch
armv6l
但我仍然无法安装 bundle ,出现以下错误:
!ENTRY 1 0 2015-06-19 10:19:40.982
!MESSAGE [IAgent][RemoteBundleAdminImpl@17f36b1] [startBundle] Bundle cannot be started: Error[code=-6000;message=Failed to start bundle: The bundle "RXTX_Bundle_1.0.0 [77]" could not be resolved. Reason: No match found for native code: /usr/lib/jni/librxtxSerial.so; processor=armv6l; osname=Linux;details=null]
!STACK 0
org.osgi.framework.BundleException: The bundle "RXTX_Bundle_1.0.0 [77]" could not be resolved. Reason: No match found for native code: /usr/lib/jni/librxtxSerial.so; processor=armv6l; osname=Linux
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1332)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1316)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:323)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
at org.tigris.mtoolkit.iagent.internal.rpc.RemoteBundleAdminImpl.startBundle(RemoteBundleAdminImpl.java:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.tigris.mtoolkit.iagent.internal.pmp.InvocationThread.run(InvocationThread.java:54)
at org.tigris.mtoolkit.iagent.internal.utils.ThreadPool$Worker.run(ThreadPool.java:179)
at java.lang.Thread.run(Thread.java:724)
我做错了什么? 非常感谢您的帮助!
更新 遵循@Jorge Martinez 的建议后: 这是我更新的 list 行:
Bundle-NativeCode: nativelib/librxtxSerial.so;osname="Linux";processor="armv6l"
这是我的 rxtx 包的内容列表:
最佳答案
Jorge 的回答是正确的。您是否实际检查了 Eclipse 创建的包以确认您的 nativelib 目录存在?从 Eclipse 导出包时,您必须确保指定构建中包含哪些文件夹和文件。这是通过打开 build.properties 文件并在您希望包含的文件夹/文件旁边放置复选标记来完成的。
关于java - 在我的树莓派中安装 rxtx 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30936314/