How to use librxtx on Ubuntu 14.04

Hi, I wrote myself an application using the XBJL on Mac and it works great. However, I need it to run on a Linux machine, specifically Ubuntu 14.04.

However, no matter what combination of RXTX/JavaComm jars and librxtxSerial.so objects (for x86_64) I use, the best result I get is that there is a seg-fault. I have searched around the internet for a couple days now and have been unable to solve the issue.

I know Digi doesn’t develop librxtx, but I was wondering if anyone else had run into this (and solved it)?

My output from the MyFirstXBeeApp.java program is as follows:

WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2-20081207 Cloudhopper Build rxtx.cloudhopper.net

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x00007fa1012465da, pid=10699, tid=140330066917120

JRE version: Java™ SE Runtime Environment (8.0_60-b27) (build 1.8.0_60-b27)

Java VM: Java HotSpot™ 64-Bit Server VM (25.60-b23 mixed mode linux-amd64 compressed oops)

Problematic frame:

C [librxtxSerial.so+0x75da] Java_gnu_io_RXTXPort_nativeDrain+0xea

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try “ulimit -c unlimited” before starting Java again

An error report file with more information is saved as:

/home/framework/Desktop/MyFirstXBeeApp/hs_err_pid10699.log

[thread 140329484539648 also had an error]

If you would like to submit a bug report, please visit:

http://bugreport.java.com/bugreport/crash.jsp

The crash happened outside the Java Virtual Machine in native code.

See problematic frame for where to report the bug.

The following post seems to match your error:

http://stackoverflow.com/questions/9567889/rxtx-error-using-smslib-and-mobile-phone-as-a-modem

1 Like

Yes, it seems that having the correct version of the librxtx binary is key (and it is easier than one might think to have the wrong one). I solved this some time ago, but in my case, I was frantically trying every version I could get my hands on; I believe that the error was caused by having an incorrect version of the binary in the folder that was in the -Djava.library.path I supplied (higher in the directory structure than the one that was correct).

So my advice to anyone trying this in the future is: first get what will likely be the correct binary via the sudo apt-get install method, then copy it into your project’s libs directory, and ensure that it is the only librxtx binary object in your project’s directory until you are sure you have the correct one.