在我的Raspberry中安装rxtx包
我想在我的Raspberry Pi上安装一个rxtx软件包,该软件包将在KURA平台上运行(Equinox是Kura的OSGi容器)
我使用以下命令安装了rxtx本机库:sudo apt-get install 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
我添加到捆绑清单中:
Bundle-NativeCode: /usr/lib/jni/librxtxSerial.so;osname="Linux";processor="armv6l"
因为我的os类型是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
但是我仍然无法安装捆绑包,我收到了这个错误:
!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的建议更新:这是我更新的清单行:
Bundle-NativeCode: nativelib/librxtxSerial.so;osname="Linux";processor="armv6l"
这是我的rxtx包的内容列表:
豪尔赫的回答是正确的。 您是否已经检查过Eclipse创建的包以确认您的nativelib目录是否存在? 从Eclipse导出捆绑包时,必须确保指定构建中包含哪些文件夹和文件。 这是通过打开build.properties文件并在您希望包含的文件夹/文件中放置一个复选标记来完成的。
您需要在您的包中嵌入本机库(在jar内或片段中)。
即如果你把你的图书馆放在这里:
/this/is/yournative/package/librxtxSerial.so
你可以使用这个清单条目:
Bundle-NativeCode: this/is/yournative/package/librxtxSerial.so;osname="Linux";processor="armv6l"
请注意,OSGi通过将本机库提取到临时文件夹然后加载它们来加载本机库。
使用此捆绑包rxtx osgi 。 它应该包含你需要的一切。
谢谢大家的回复! 捆绑是活跃的!
我使用此链接获取rxtx源并编译我的本机源: https ://blogs.oracle.com/jtc/entry/java_serial_communications_revisited
我更新了build.properties以包含本机库。