简体   繁体   中英

RXTX on Ubuntu 12.04 & Netbeans

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:

java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver

Any ideas ?

Have you tried to install librxtx-java package?

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

$ 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

After that, probably you must add /usr/share/java/RXTXcomm.jar to your classpath.

$ 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

$ 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 documentation for adding the jar to the classpath.

Hope this will help you

Using Netbeans 7.2 on 12.04 all I did was install the package like so: 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 Libraries and adding the file using the Add JAR/Folder Button.

All set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM