jump to navigation

Java 6 and librxtxSerial.jnilib on Intel Mac OS X August 18, 2009

Posted by Robert Harder in Utility.

[UPDATE: This library works with Mac OS X 10.6 Snow Leopard.]

In order to access a serial port in Java, you need the RXTX libraries compiled for your specific hardware. Java uses the Java Native Interface (JNI) to bridge between your platform-independent application code and the hardware-specific serial port drivers.

If you’ve tried this on an Intel Mac (perhaps to play with a Sun SPOT), you may be disappointed, since software keeps shipping from people that is either PowerPC only or isn’t compiled for 64-bit Intel. You’ve probably seen the UnsatisfiedLinkError message. Here you’ll find a librxtxSerial.jnilib file with support for both 32- and 64-bit PPC and Intel architectures, fitting the bill perfectly for both Java 5 and Java 6 on the Mac.

$ file librxtxSerial.jnilib
librxtxSerial.jnilib: Mach-O universal binary with 4 architectures
librxtxSerial.jnilib (for architecture x86_64):	Mach-O 64-bit bundle x86_64
librxtxSerial.jnilib (for architecture i386):	Mach-O bundle i386
librxtxSerial.jnilib (for architecture ppc7400): Mach-O bundle ppc
librxtxSerial.jnilib (for architecture ppc64):	Mach-O 64-bit bundle ppc64