Arduino + Processing erroring out on Ubuntu when trying to use the Serial library

I bought a 3-axis accelerometer and I wanted to play with it using Processing. I thought it was really simple but it seems I was wrong as on Ubuntu 10.04 there is an issue with Processing software and a small and simple code like this :

import processing.serial.*;
import cc.arduino.*;

void draw()
{
  println(Arduino.list());
  delay(2000);
}

crashes with “Error inside Serial.ports()”

java.lang.UnsatisfiedLinkError: /home/sorin/partition/arduino-0021/processing-1.2.1/libraries/serial/library/librxtxSerial.so: /home/sorin/partition/arduino-0021/processing-1.2.1/libraries/serial/library/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch) thrown while loading gnu.io.RXTXCommDriver
java.lang.UnsatisfiedLinkError: /home/sorin/partition/arduino-0021/processing-1.2.1/libraries/serial/library/librxtxSerial.so: /home/sorin/partition/arduino-0021/processing-1.2.1/libraries/serial/library/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1803)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1728)
	at java.lang.Runtime.loadLibrary0(Runtime.java:823)
	at java.lang.System.loadLibrary(System.java:1028)
	at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:83)
	at processing.serial.Serial.list(Unknown Source)
	at cc.arduino.Arduino.list(Arduino.java:139)
	at _3axiscontrol.draw(_3axiscontrol.java:53)
	at processing.core.PApplet.handleDraw(Unknown Source)
	at processing.core.PApplet.run(Unknown Source)
	at java.lang.Thread.run(Thread.java:662)
processing.app.debug.RunnerException: RuntimeException: Error inside Serial.ports()
	at processing.app.Sketch.placeException(Sketch.java:1543)
	at processing.app.debug.Runner.findException(Runner.java:582)
	at processing.app.debug.Runner.reportException(Runner.java:558)
	at processing.app.debug.Runner.exception(Runner.java:498)
	at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
	at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
	at processing.app.debug.EventThread.run(EventThread.java:89)
Exception in thread "Animation Thread" java.lang.RuntimeException: Error inside Serial.ports()
	at processing.serial.Serial.errorMessage(Unknown Source)
	at processing.serial.Serial.list(Unknown Source)
	at cc.arduino.Arduino.list(Arduino.java:139)
	at _3axiscontrol.draw(_3axiscontrol.java:53)
	at processing.core.PApplet.handleDraw(Unknown Source)
	at processing.core.PApplet.run(Unknown Source)
	at java.lang.Thread.run(Thread.java:662)

The solution to fix this is very simple (now, after 1h+ of frustration 🙂 ) : go to your Arduino software folder (in my case “arduino-0021”) and then copy from the “lib” folder these 2 files :
– RXTXcomm.jar
– librxtxSerial.so
and paste them in the Processing software folder (in my case “processing-1.2.1”), in the “libraries/serial/library” subfolder.

That’s all …

8 comments on “Arduino + Processing erroring out on Ubuntu when trying to use the Serial library

  1. THANK YOU! This solved my problem on Ubuntu 10.10 with Processing 1.2.1 and Arduino 0022.

    Thank you thank you thank! 🙂

  2. I encountered the same errors.I am using processing-1.5.1.There is no folder with the name libraries.So I made one and pasted the files.The problem continues to exist.I am using Ubuntu 10.04 and arduino 1.0.

  3. thx a lot, same problem solved with ubuntu lucid, processing 1.2.1 and arduino 0023 …

    just a little tip for newbies 🙂 connect your arduino board or it won’t work 🙂

    looking for the solution with arduino 1.0 and processing 1.5 …

  4. Anyone found the solution to this issue with Processing 1.5 and Arduino 1.0 yet? Do I have to revert to older versions to get my project to work?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.