rxtxSerial librxtx-java Ubuntu

2019-06-03 15:22发布

问题:

I am getting the following error when I try to run my Java application:

java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1878) at java.lang.Runtime.loadLibrary0(Runtime.java:849) at java.lang.System.loadLibrary(System.java:1087) at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:123) at gqueak.GSqueak.connect(GSqueak.java:29) at gsqueak.GSqueak.main(GSqueak.java:67)

I have installed librxtx-java like so:

sudo apt-get install librxtx-java

My /etc/enviroment is:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" CLASSPATH="/usr/share/java/:/usr/share/java/RXTXcomm.jar:/usr/lib/jni/librxtxSerial.so:." JAVA_HOME="/usr/lib/jvm/java-7-oracle:/usr/share/java/RXTXcomm.jar:/usr/lib/jni/librxtxSerial.so:."

The RXTXComm.jar has been added to my netbeans Libraries and -Djava library path="/usr/lib/jni/" has been added to my VM Options within Netbeans.

I copied /usr/lib/jni/librxtxSerial.so to /usr/lib/jvm/java-7-oracle/jre/lib/amd64

I'm lost now as to what to do about to chew he keyboard.

Ubuntu 13.04 java version "1.7.0_25" (Oracle) Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Thanks,

回答1:

For me it worked out to add the VM option -Djava.library.path=/usr/lib/jni -cp /usr/share/java/RXTXcomm.jar:. to the VM Options of Netbeans.