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/librxtxSerial.so: /home/pi/JMRI/lib/linux/armv5/librxtxSerial.do: cannot open shared object file: No such file or directory thrown while loading gnu.io.RXTXCommDriver .
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?
thanks
David Barham
Re: Java and RXTX
Your RXTX library path looks like it's for armv5 - isn't the RasPi using ARMv6?
Re: Java and RXTX
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
mv librxtxSerial.so librxtxSerial.so.jmri
#cp /usr/lib/jni/librxtxSerial.so .
# I just symlinked it
ln -s /usr/lib/jni/librxtxSerial.so
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
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
mv librxtxSerial.so librxtxSerial.so.jmri
#cp /usr/lib/jni/librxtxSerial.so .
# I just symlinked it
ln -s /usr/lib/jni/librxtxSerial.so
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
-
- Posts: 6
- Joined: Fri Dec 23, 2011 11:22 pm
Re: Java and RXTX
Strictly speaking, the RXTX driver supplied in JMRI doesn't work with Rasbian - it does work with vanilla Debian on a RaspberryPi.barhamd wrote:the RXTX driver supplied in JMRI doesn't work and so you need to install librxtx
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
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 "librxtxSerial.so", however. If I attempting to symlink either by issuing the command
ln -s /usr/lib/jni/librxtxSerial.so
the system responds by saying that links to the version of "librxtxSerial.so" 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
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 "librxtxSerial.so", however. If I attempting to symlink either by issuing the command
ln -s /usr/lib/jni/librxtxSerial.so
the system responds by saying that links to the version of "librxtxSerial.so" 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
Re: Java and RXTX
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.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
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 http://jmri.svn.sourceforge.net/viewvc/ ... 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)

Slackware ARM on the Raspberry Pi -> http://www.daves-collective.co.uk/raspi/
-
- Posts: 13
- Joined: Wed Aug 31, 2011 3:11 pm
Re: Java and RXTX
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 https://github.com/proffalken/JMR-Pi and you will need to install the Raspbian Image from the raspberrypi.org 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.
The code is available at https://github.com/proffalken/JMR-Pi and you will need to install the Raspbian Image from the raspberrypi.org 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.
Re: Java and RXTX
Hi,
I use the Soft-float Debian “wheezy” with Oracle 7 SE (http://www.oracle.com/technetwork/artic ... .html#Java).
Install Lib:
sudo apt-get install librxtx-java
Create symbolic link in "{java.home}/lib/arm/":
ln -s /usr/lib/jni/librxtxSerial.so
(librxtxSerial.so -> /usr/lib/jni/librxtxSerial.so)
"/usr/lib/jni/librxtxSerial.so" is also a symbolic link created by apt-get to the " librxtxSerial-2.2pre1.so".
Works fine!
With OpenJdk in Raspbian “wheezy” it works out of the box and no symbolic link required.
I use the Soft-float Debian “wheezy” with Oracle 7 SE (http://www.oracle.com/technetwork/artic ... .html#Java).
Install Lib:
sudo apt-get install librxtx-java
Create symbolic link in "{java.home}/lib/arm/":
ln -s /usr/lib/jni/librxtxSerial.so
(librxtxSerial.so -> /usr/lib/jni/librxtxSerial.so)
"/usr/lib/jni/librxtxSerial.so" is also a symbolic link created by apt-get to the " librxtxSerial-2.2pre1.so".
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
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 hereproffalken wrote:The code is available at https://github.com/proffalken/JMR-Pi
