java.lang.UnsatisfiedLinkError: librxtxSerial.jnilib: no suitable image found
Apple had always bundled Java with OS X, but about 3 years ago they announced they would no longer do so. Now, to get Java 7 for the mac you need to get it from Oracle. Recently I tried running one of my RXTX apps with Oracle's Java 7 and I got the following error:
Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.
It seems that Oracle no longer supports the -d32 vm argument. I tried installing Apple's Java 6, but it refused, saying it required OS X 10.6. Then I tried the librxtxSerial.jnilib that comes with Arduino, but it is also 32-bit mode. A few searches led me to Arduino article that mentions Robert Harder's blog post http://blog.iharder.net/2009/08/18/rxtx-java-6-and-librxtxserial-jnilib-on-intel-mac-os-x/ In this post Robert describes how he compiled RXTX for 64-bit Java (apparently not a trivial task). After downloading his librxtxSerial.jnilib it worked, the first time; the second time I got an exception:
“gnu.io.PortInUseException: Unknown Application”
This was super annoying since I didn't have any other Java processes running that had the port open. I read through the comments and found a solution:
sudo mkdir /var/lock
sudo chmod a+wrx /var/lock
Apparently RXTX needs this directory to manage locks. This was also mentioned on the Arduino article but I missed it the first time.