How to install RXTX Java library for Mountain Lion.
While trying to develop a Serial Port reading Java program I ran into a number of errors, mainly:
- dlopen(/Library/Java/Extensions/librxtxSerial.jnilib, 1): no suitable image found.
It took me a long time before I found any resources on how to do this so I decided to write one up when I finally got it working.
I’m not the most technical, so this is not too technical! In a nutshell, you are adding two files to the Java library on your Mac – RXTXComm.jar and librxtxSerial.jnilib
Hopefully it will help:
- Go to http://rxtx.qbang.org/wiki/index.php/Download and download the binary version 2.1.7.
- Unzip the folder and place the unzipped folder on your desktop.
- Open the folder and navigate to the Mac_OS_X folder.
- Delete the librxtxSerial.jnilib file (I found that this file is using Java 5, and with Mountain Lion I was using Java 6).
- Go to Robert Harder’s blog and download his version of the librxtxSerial.jnilib file. Direct link here. Just want to say thank you to Robert for his blog post – it saved me big time. What he has done is compiled a Java 6 friendly version of librxtxSerial.jnilib.
- Save this new librxtxSerial.jnilib file in the Mac_OS_X folder of the RXTX folder you have on your desktop from step 2.
- Open Terminal and type the following:
cd <where you unpacked it>/rxtx-2.1-7-bins-r2/
sudo cp RXTXcomm.jar /Library/Java/Extensions
sudo cp Mac_OS_X/librxtxSerial.jnilib /Library/Java/Extensions
Now you shouldn’t have any more RXTX errors when compiling your Java program.