java Ubuntu 12.04 和 Netbeans 上的 RXTX
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11380526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
RXTX on Ubuntu 12.04 & Netbeans
提问by DevilCode
Looking to add RXTXcomm.jar (the javax.comm replacement) from http://rxtx.qbang.org/I can add RXTXcomm.jar to the project library with no problems but I get the error:
希望从http://rxtx.qbang.org/添加 RXTXcomm.jar(javax.comm 替代品), 我可以毫无问题地将 RXTXcomm.jar 添加到项目库中,但出现错误:
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
java.lang.UnsatisfiedLinkError:加载 gnu.io.RXTXCommDriver 时在 java.library.path 中没有抛出 rxtxSerial
Any ideas ?
有任何想法吗 ?
回答by sourcerebels
Have you tried to install librxtx-java package?
您是否尝试过安装 librxtx-java 包?
$ aptitude search rxtx
v lib-rxtx-java -
v lib-rxtx-java:i386 -
p librxtx-java - Full Java CommAPI implementation
p librxtx-java:i386 - Full Java CommAPI implementation
p librxtx-java-dbg - Full Java CommAPI implementation, Debugging Symbols
p librxtx-java-dbg:i386 - Full Java CommAPI implementation, Debugging Symbols
Probably you need this .so files:
可能你需要这个 .so 文件:
$ apt-file list librxtx-java | grep jni
librxtx-java: /usr/lib/jni/librxtxI2C-2.2pre1.so
librxtx-java: /usr/lib/jni/librxtxI2C.so
librxtx-java: /usr/lib/jni/librxtxParallel-2.2pre1.so
librxtx-java: /usr/lib/jni/librxtxParallel.so
librxtx-java: /usr/lib/jni/librxtxRS485-2.2pre1.so
librxtx-java: /usr/lib/jni/librxtxRS485.so
librxtx-java: /usr/lib/jni/librxtxRaw-2.2pre1.so
librxtx-java: /usr/lib/jni/librxtxRaw.so
librxtx-java: /usr/lib/jni/librxtxSerial-2.2pre1.so
librxtx-java: /usr/lib/jni/librxtxSerial.so
librxtx-java-dbg: /usr/lib/debug/usr/lib/jni/librxtxI2C-2.2pre1.so
librxtx-java-dbg: /usr/lib/debug/usr/lib/jni/librxtxParallel-2.2pre1.so
librxtx-java-dbg: /usr/lib/debug/usr/lib/jni/librxtxRS485-2.2pre1.so
librxtx-java-dbg: /usr/lib/debug/usr/lib/jni/librxtxRaw-2.2pre1.so
librxtx-java-dbg: /usr/lib/debug/usr/lib/jni/librxtxSerial-2.2pre1.so
You can install it with:
您可以使用以下命令安装它:
$ sudo apt-get install librxtx-java
$ sudo apt-get install librxtx-java
After that, probably you must add /usr/share/java/RXTXcomm.jar to your classpath.
之后,您可能必须将 /usr/share/java/RXTXcomm.jar 添加到您的类路径中。
$ apt-file list librxtx-java | grep jar
librxtx-java: /usr/share/java/RXTXcomm-2.2pre2.jar
librxtx-java: /usr/share/java/RXTXcomm.jar
Here you can find gnu.io.CommPort class
在这里你可以找到 gnu.io.CommPort 类
$ jar tvf /usr/share/java/RXTXcomm.jar | grep CommPort
1453 Fri Nov 11 10:39:50 CET 2011 gnu/io/CommPort.class
818 Fri Nov 11 10:39:50 CET 2011 gnu/io/CommPortEnumerator.class
5753 Fri Nov 11 10:39:50 CET 2011 gnu/io/CommPortIdentifier.class
340 Fri Nov 11 10:39:50 CET 2011 gnu/io/CommPortOwnershipListener.class
You can follow Netbeans documentationfor adding the jar to the classpath.
您可以按照Netbeans 文档将 jar 添加到类路径。
Hope this will help you
希望能帮到你
回答by t.heintz
Using Netbeans 7.2 on 12.04 all I did was install the package like so: sudo apt-get install librxtx-java
在 12.04 上使用 Netbeans 7.2 我所做的就是像这样安装包: sudo apt-get install librxtx-java
Then all that's left to do in the Netbeans project is to add the actual jar file, which lives in /usr/share/java/rxtxcomm.jar
to the class path by opening the project properties, navigating to Librariesand adding the file using the Add JAR/FolderButton.
然后在 Netbeans 项目中剩下要做的就是添加实际的 jar 文件,/usr/share/java/rxtxcomm.jar
通过打开项目属性,导航到库并使用添加 JAR/文件夹按钮添加文件,该文件位于类路径中。
All set.
可以了,好了。