Go Down

Topic: Serial: I must use Arduino's RXTX libs with Java in Mac Snow Leopard (Read 4666 times) previous topic - next topic


I've been trying to set up my Snow Leopard Mac with RXTX so I can write Java applications to communicate with my Arduino over the serial port. Got it working, but still puzzled about why the RXTX-recommended way didn't work.

I got   rxtx-2.1-7-bins-r2.zip OS X binaries from rxtx.qbang.org, and copied RXTXcomm.jar and librxtxSerial.jnilib into /Library/Java/Extensions as instructed in the installation page. When those files are there, IDE 0022 can't upload or open the serial monitor, it says the port is already in use. Remove the files and IDE is happy again.

Instead I found the files provided with my IDE 22, in /Applications/Arduino.app/Contents/Resources/Java, and copied those into /Library/Java/Extensions. Now the IDE works fine. I compiled and ran SerialTest.java from the Playground/Interfacing/Java page (just using javac/java in the shell), and all is well with that too (see below).

I'm wondering why the difference? Should the Playground/Interfacing/Java page be revised to use IDE's RXTX library files? Thanks!


MBMBPro:Java mike$ java -d32 SerialTest
Experimental:  JNI_OnLoad called.
Stable Library
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
Hello world!
Hello world!


I've just bough a refurbished MacBook Air running with Mac OS X 10.6 Snow Leopard.

Just want to make sure I understand your method to install RXTXcomm.jar and librxtxSerial.jnilib into /Library/Java/Extensions

Do you mean that you found these files directly inside IDE 22 folder/subfolder then copy pasted into /Library/Java/Extensions ?

If yes, how do you access /Applications/Arduino.app/Contents/Resources/Java ?



I've found this site http://blog.iharder.net/2009/08/18/rxtx-java-6-and-librxtxserial-jnilib-on-intel-mac-os-xwhich seems to provide good guidance & solution on how to install in Macintosh these 2 files required to communicate between arduino and Java via USB:

  • RXTXcomm.jar

  • librxtxSerial.jnilib

The author of this site provides a download of his own librxtxSerial.jnilib and you'll see on of his comments that he re-directs towards this other site http://rxtx.qbang.org/wiki/index.php/Download to download RXTXcomm.jar

Long ago, I've developped a java application (let's call it zpe.jar) which successfully interfaces between my iMac (Tiger) and arduino mega.

A few days ago, I've bought a refurbished MacBook Air running with Snow Leopard but my zpe.jar will not launch if I'm using both RXTXcomm.jar and librxtxSerial.jnilib coming from my iMac (Tiger version).

Now i've successfully installed both RXTXcomm.jar and librxtxSerial.jnilib from the above site and my zpe.jar launches & displays correctly my java application with template, sliders,... it does show the USB adress of arduino mega but it will not transfer any data.

Hoping someone can help !


Sep 04, 2011, 06:37 am Last Edit: Sep 04, 2011, 08:20 am by selfonlypath Reason: 1
OK I've finally found a stable way to install RXTX and JNLI files to work on MacBook Air with Snow Leopard.

First remark: in my case, copying arduino IDE RXTX & JNLI files into into /Library/Java/Extensions does not solve the problem which is strange !

Second remark: the JNLI provided by this site http://blog.iharder.net/2009/08/18/rxtx-java-6-and-librxtxserial-jnilib-on-intel-mac-os-x seems incompatible with most RXTX so I could not get it to work.

The way of working is to download from http://rxtx.qbang.org/wiki/index.php/Download the binary rxtx 2.2pre2 (prerelease), this folder contains in another folder a Mac OS 10.5 JNLI not supposed to work with OSX 10.6 but it does real good job.

P.S. This webpage provides vary valuable info on the RXTX and JNLI issue http://create-lab-commons.googlecode.com/svn-history/r96/trunk/java/lib/rxtx/README.txt


Hum... I've feeling that IDE version 22 is NOT compatible with Snow Leopard, at least on a MacBook Air.

Above in the thread, I've indicated one set of RXTXcomm.jar and librxtxSerial.jnilib finally compatible with java on Snow Leopard. Only problem now, it prevents IDE version 22 to download any PDE sketch... IDE aborts & propose to send bug to Apple.

This might explain why RXTX and JNLIB files used by IDE 22 would block any USB connection via my zpe.jar applications once copied into Library/Java/Extensions folder

Obviously there is a BIG compatibility issue between arduino version 22 and USB java files !

Any ideas how to fix this problem, maybe older IDE version being NON-java based to download !!!




can you try Arduino 1.0 beta 3 (use the RXTX+jnli from there)?

Just to make sure.


Hi Alvie,

Just downloaded per your suggestion, put the RXTX & JNLIB files inside global java libraries but unfortunately, it will not work on ZPE.jar which has been compiled by ant 1.8.2 !

Worthwhile noting I previously download IDE 17, same problem as with IDE 2 or the beta release you suggested so I really don't understand how arduino can run correctly RXTX & JNLIB files which don't work on JAR files compiled latest official ANT.


Go Up