Posts: 5
Joined: Wed Jul 04, 2012 8:02 am

Java and RXTX

Wed Jul 25, 2012 10:19 pm

I'm trying to get JMRI (Java Model Railway Interface) to run on my Raspian Pi

I've installed the java SDK using "sudo apt-get install openjdk-6-jre" and java -version now returns 'java version "1.6.0_24"'

I've plugged in the USB from my MERG CAN-USB and see a Bus 001 Device ID
0403:6001 Future Technology Devices International Ltd FT232 USB-Serial
(UART) from lsusb which is what I would expect. I also see /dev/ttyUSB0

however when I try to configure the JMRI to use the port I'm getting a message
java.lang.UnsatisfiedLinkError: /home/pi/JMRI/lib/Linux/armv5/ /home/pi/JMRI/lib/linux/armv5/ cannot open shared object file: No such file or directory thrown while loading .

so it seems clear I need to download and compile RXTX. However all the links to the source seem dead. Has anyone tried getting Javacomm to talk to a serial connection via USB?

David Barham

Posts: 17
Joined: Wed May 30, 2012 5:36 am

Re: Java and RXTX

Wed Jul 25, 2012 11:16 pm

Your RXTX library path looks like it's for armv5 - isn't the RasPi using ARMv6?

Posts: 5
Joined: Wed Jul 04, 2012 8:02 am

Re: Java and RXTX

Thu Jul 26, 2012 9:51 am

sorted out my own problem, but I'll document the answer here in case anyone else comes looking.

the RXTX driver supplied in JMRI doesn't work and so you need to install librxtx

sudo apt-get install librxtx-java
#download and unpack latest jmri
#replace the jmri supplied librxtx with the one you just installed

cd /home/pi/JMRI/lib/linux/armv5
#cp /usr/lib/jni/ .
# I just symlinked it
ln -s /usr/lib/jni/

Last night I worked out for myself and ended up with a working set up,
driving trains using my android tablet via JMRI on the pi. JMRI is very slow to start for the first time so be patient (3 mins +) but
considerably faster next time around when you have configured things.

I was really pleased to have cracked this. Makes the idea of using JMRI for
an exhibition model railway layout much more appealing now I can run it on a £25 Pi
rather than an expensive laptop or heavy deskside.

David Barham

Matt Harris
Posts: 6
Joined: Fri Dec 23, 2011 11:22 pm

Re: Java and RXTX

Thu Jul 26, 2012 12:33 pm

barhamd wrote:the RXTX driver supplied in JMRI doesn't work and so you need to install librxtx
Strictly speaking, the RXTX driver supplied in JMRI doesn't work with Rasbian - it does work with vanilla Debian on a RaspberryPi.

As mentioned over on the jmriusers list, I do need to update the JMRI distribution to cater for the Rasbian image but haven't had a chance to work on this yet.

Best regards,

Matt H

Posts: 10
Joined: Sat Jun 02, 2012 7:19 pm

Re: Java and RXTX

Sun Jul 29, 2012 8:44 pm

I too would like to get my Raspberry Pi working with JMRI so that I can control my model railway layout via my SPROG 3.

I've tried out Mr Barham's instructions but get different and unsuccessful results. I'm okay until I get to the line where he says:

#replace the jmri supplied librxtx with the one you just installed

but then things go adrift. My installation of JMRI at /usr/lib/JMRI doesn't have a subdirectory called /usr/lib/JMRI/lib/linux/armv5. Instead, it has two others, named /usr/lib/JMRI/lib/linux/x86 and /usr/lib/JMRI/lib/linux/i386. Both contain files called "", however. If I attempting to symlink either by issuing the command

ln -s /usr/lib/jni/

the system responds by saying that links to the version of "" in /usr/lib/jni already exist .

So I'm not sure how it's all supposed to tie together. Can anyone advise?

Despite all of the above, I can run DecoderPro from FileManager by clicking on the DecoderPro icon with the /usr/lib/JMRI subdirectory selected. DecoderPro appears to start up correctly, but when I try to set the connections to my SPROG3 I get the dialogue box:

Failed to load comm library, You have to fix that before setting preferences

Can anyone advise on this, too?

Thanks in advance,

Simon Hood

User avatar
Posts: 16
Joined: Sun Jun 03, 2012 4:12 pm

Re: Java and RXTX

Mon Jul 30, 2012 11:18 am

thunderbird1 wrote:My installation of JMRI at /usr/lib/JMRI doesn't have a subdirectory called /usr/lib/JMRI/lib/linux/armv5. Instead, it has two others, named /usr/lib/JMRI/lib/linux/x86 and /usr/lib/JMRI/lib/linux/i386
Only JMRI version 3.0, released two days ago (and the prior test releases), has the ARM support you need in the lib/linux/armv5 subdirectory. Neither 2.14 nor 2.14.1 is good enough. Everything you did after you found the armv5 subdirectory missing was a waste of time, and quite possibly counterproductive.

You need to start again with a nice new JMRI. The Linux version of 3.0 is unavailable through the usual channels, due to an apparent administrative oversight, but it can be obtained via ... hrev=20870.

Even then, the possibility exists (as MattH pointed out) that neither your openjdk nor the JMRI ARM support is compatible with Raspbian armv6 hardfp. Good luck with that. Plain Debian should work. For avoidance of doubt I neither know nor care about this (see sig) :D
Slackware ARM on the Raspberry Pi ->

Posts: 13
Joined: Wed Aug 31, 2011 3:11 pm

Re: Java and RXTX

Thu Nov 15, 2012 4:24 pm

I assume that you have resolved this issue, however for those that stumble acorss this thread in future, I have created a script that can be downloaded to convert a "standard" official Raspbian image into a JMRI control centre.

The code is available at and you will need to install the Raspbian Image from the website, boot into that image and then follow the instructions in the README for JMR-Pi in order to get it to work.

Please note that the usual warnings apply about flashing existing SD cards (data loss etc), so either use a dedicated card for this or make sure you've taken a backup before you re-flash the image.

Posts: 2
Joined: Wed Feb 13, 2013 9:53 pm

Re: Java and RXTX

Wed Feb 13, 2013 10:00 pm


I use the Soft-float Debian “wheezy” with Oracle 7 SE ( ... .html#Java).

Install Lib:
sudo apt-get install librxtx-java

Create symbolic link in "{java.home}/lib/arm/":

ln -s /usr/lib/jni/
( -> /usr/lib/jni/

"/usr/lib/jni/" is also a symbolic link created by apt-get to the "".

Works fine!

With OpenJdk in Raspbian “wheezy” it works out of the box and no symbolic link required.

Posts: 362
Joined: Sat Jul 27, 2013 11:36 am

Re: Java and RXTX

Fri Sep 06, 2013 4:20 pm

proffalken wrote:The code is available at
Sorry to come back to this so late, but could you explain why you've added a Samba install? Would an NFS setup work too? (Linux-only here ;))

Return to “Other programming languages”