Posts: 2
Joined: Sun Apr 24, 2016 12:48 pm

Problem with gnu.io.RXTXCommDriver

Tue Jul 11, 2017 11:34 am

I have raspberry pi3 with raspbian and java 8 jdk installed.

I have program which uses https://github.com/NeuronRobotics/nrjavaserial . It works perfectly on Windows, but when i tried to run it on raspberry I got:

Code: Select all

java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; 
thrown while loading gnu.io.RXTXCommDriver
java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver
I installed rxtx by

Code: Select all

sudo apt-get install librxtx-java
like it was shown here: viewtopic.php?f=81&t=69414

App is started by this command:

Code: Select all

java -Djava.library.path=/usr/lib/jni -cp /usr/share/java/RXTXcomm.jar:. -jar appName.jar

Posts: 9
Joined: Mon May 25, 2015 9:17 pm

Re: Problem with gnu.io.RXTXCommDriver

Fri Sep 15, 2017 5:56 pm

Don't use the RxTx library, it's outdated, unsupported and problematic to install.
Use http://fazecast.github.io/jSerialComm/ - same features without all the hassle of manually installing native binaries

Posts: 85
Joined: Thu Jun 29, 2017 12:39 pm

Re: Problem with gnu.io.RXTXCommDriver

Thu Nov 02, 2017 10:58 pm

Another RxTx user here, and thanks for the tip. Will try the alternative in my next project. :)

My personal experience is that it works better with OpenJDK JVM, as opposed the Oracle JVM. Probably another of those library loading issues. Most likely quite solvable, but needs lots of trying.

Posts: 85
Joined: Thu Jun 29, 2017 12:39 pm

Re: Problem with gnu.io.RXTXCommDriver

Wed Nov 08, 2017 4:09 pm

So I tested them, with as much time I had.

I needed to get a Scanse Sweep rotating lidar working, and get it working soon...

...I wrote the initial code for jSerialComm and it worked on my laptop. On a Pi 0W unit, it mysteriously did nothing, with no error messages whatsoever. The port opened, but no commands seemed to reach the lidar unit.

So in the end, I turned to Pi4j and got it working. Pi4j apparently supports all kinds of ports, not only GIPO and SPI, but also serial. :)

Return to “Java”