Processing 2.1 + Oracle Java + Raspberry Pi + Serial + Arduino = ☺

Hey! This is very old and there’s an officially supported version out now coming out very soon.

Update for Raspberry Pi 2/Processing 2.2.1/Processing 3.0.5: Raspbian now ships with Java 8, and Processing only likes Java 7. oracle-java7-jdk is still in the repos, so install that, and follow the instructions below. It’s a bit flakey, but when it runs, runs quite fast on the Raspberry Pi 2. You might have more luck running Processing.js or p5.js in the browser.

With Sun Oracle hardfloat Java now available, Processing now runs at a decent clip on the Raspberry Pi. My old instructions are now very obsolete. Here are current, tested instructions for installing it under Raspbian.

[This is a particular solution to installing a Serial/Firmata-enabled Processing 2.1 distribution on a Raspberry Pi. Processing still has issues with other aspects of visual programming (particularly video) that I’m not addressing here.]

A lot of software is installed here, and much of it depends on previous steps. Don’t jump in mid-way and expect it to work.

Update the system

Always a good plan if you’re doing major upgrades:

sudo apt-get update
sudo apt-get dist-upgrade

Install Sun Oracle Java

sudo apt-get install oracle-java7-jdk

Check if the right version is installed as default: java -version should give

java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) Client VM (build 24.0-b56, mixed mode)

If you get anything else, you need to make Sun Oracle’s version the default:

sudo update-alternatives --config java

Download & Install Processing

Go to Download \ and get the Linux 32-bit version.  It’s big; about 100 MB. I’m going to install it in my home directory, so the base path will be ~/processing-2.1. Extract it:

tar xvzf processing-2.1-linux32.tgz

Now you have to remove the included x86 Java runtime, and replace it with the Raspberry Pi’s armhf one:

rm -rf ~/processing-2.1/java 
ln -s /usr/lib/jvm/jdk-7-oracle-armhf ~/processing-2.1/java

You should now have a Processing installation that will run, but there’s some more we need to get serial and Arduino support.

Install the  java Simple Serial connector

Download and extract it:


Now overwrite the jssc.jar that ships with Processing with the one you just downloaded:

mv jSSC-2.6.0-Release/jssc.jar ~/processing-2.1/modes/java/libraries/serial/library/

(You can remove the jSSC folder now: rm -r jSSC-2.6.0-Release)

Test Processing’s serial support

You’re almost there! Fire up Processing:


and try Perhaps the World’s Most Boring Processing Sketch:

// Example by Tom Igoe

import processing.serial.*;

// The serial port
Serial myPort;

// List all the available serial ports

Screenshot from 2014-01-07 20:08:32When this runs (it’s a little slow), you should get a single line of output, which should start /dev/tty___:


(I have an Arduino Leonardo attached, which usually appears as an ACM device.)

Installing Arduino/Firmata support

(I’m not going to go into uploading Firmata onto your Arduino here. All I can recommend is that you use the newest version at firmata/arduino, rather than the old code bundled with your Arduino distribution.)

Exit Processing, and download from firmata/processing. Extract it into your Processing sketchbook:

unzip -d ~/sketchbook/libraries/

For tedious reasons, you also have to rename one of the files:

mv  ~/sketchbook/libraries/arduino/library/Arduino.jar  ~/sketchbook/libraries/arduino/library/arduino.jar

Start up Processing again, and  save Most Probably the World’s Second Least Interesting Processing Program™:

import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int ledPin = 13;

void setup()
  arduino = new Arduino(this, Arduino.list()[0], 57600);
  arduino.pinMode(ledPin, Arduino.OUTPUT);

void draw()
  arduino.digitalWrite(ledPin, Arduino.HIGH);
  arduino.digitalWrite(ledPin, Arduino.LOW);

Screenshot from 2014-01-07 21:13:54
What this sketch does is emulate the µC’s “Hello World” program, Blink. It flashes the board’s LED once per second. Boring? Yes. But if it worked, you have a working Processing 2.1 installation on your Raspberry Pi. Go forth and make more interesting things.
(Props to bitcraftlab/wolfing for the basic outline for installing Processing, and for samaygoenka for the prodding needed to update and test the Processing installation process. If you’re still stuck, the Processing 2.0 Forum and the Raspberry Pi Forum are good places to ask.)

40 thoughts on “Processing 2.1 + Oracle Java + Raspberry Pi + Serial + Arduino = ☺”

  1. new to linux and arduino. trying to install new library for i2c display from adafruit. have updated to 1.0.5 ok and have lastest java ok .——— but get java type error messages when trying to update /usr/share/arduino/libraries from adafruit zip file

    have tried to download linux32 – get zip file called processing 2.1.1-linux32.tgz ok but …………………………

    tar command gives gzip : stdin : unexpected end of file

    Any ideas ? Thanks

  2. User libraries shouldn’t go in /usr/share/arduino – they usually go in a libraries folder under your sketches folder (so in my case, ~/Documents/Arduino/libraries). I don’t know which I2C library you’re referring to, so maybe it has special instructions.

    Sounds like your Processing download didn’t complete if you got those messages.

  3. Would like to get this working in Coder so it can be acceded remotely via computer for educational use in schools / any advice?


  4. what is the purpose of base path? i dont know what to do from downloading processing onwards. please help me.

  5. This is great !
    I just got the RPi and am totally new to Raspbian. Thought that I could just download Processing onto the RPi and it would work. Boy was I wrong ! Thank goodness for your excellent instructions. I just modified it slightly to accommodate Processing version 2.1.1 – and it worked perfectly…well almost perfectly… there is some Pixel issue – but from what I can see, this should not affect me too much.

    Thank you very much for your post.
    It helped me heaps !

  6. Incredible tutorial. I got most of it to work (after some trial and error with WGETand GIT).

    everything appears to work, except Arduino Uno doesn’t blink. Is this related to the prior speed baur rate on the Arduino? I see RX blink every few seconds (once) then TX sometimes, but no blink LED 13.

    the device is detected (ACM0) and the Java obviously runs

    any help would be appreciated. I am working on RF24l01 to transmit over the air real time gyro and accel readings and want to be able to show it in sudo realtime. Instead of blowing up my Mac, I figured I try the Raspi first.

  7. RE: 02014-03-13 AT 12:52

    I realized that failed to do an intermediate step to load Firmata to the Arduino (Uno in this case). Once that was done, it worked as expected. Thank you very much for the tutorial and exact commands.

  8. Hey, I just saw that you’ve actually mentioned my post asking for help on this – just wanted to say it’s great that that my prodding got you to write this incredible guide, and it feels nice to have been acknowledged! Thanks.:-D

  9. Hi!
    I cannot get this last step to work.
    unzip -d ~/sketchbook/libraries/

    When I download on the link provided I only get

    Inside that folder there is but when I extrac this into my library folder and run the program I get the message: ” a library used by this sketch is not installed properly”

  10. I have installed Processing 2.2 to work, but the Serial step doesn’t produce any listed devices. The board is showing up when I run lusb.

    I amended the path for mv to 2.2, and the jar file is there.

    Any ideas ?

  11. I followed all the steps but with the latest version of processing (2.2.1 as of this comment) and it all seemed to work. Processing started, but when I tried to add serial support and actually run a program, ruh-roh:

    The lines not visible are extremely long. Any advice? I’m not (at all) familiar with Java so most of it means nothing to me.

  12. I have processing running on my raspberry pi, but I am trying to download the library peasycam and add it to my sketchbook libraries folder. the problem is when i run the example sketch from peasycam, I get the error, “peasycam does not exist” and “libraries need to be downloaded in the libraries folder within the sketchbook.” I followed these directions but no luck. i tried following your example of how you downloaded arduino but still no luck…any suggestions?

  13. Hello and thanks for this guide. I have a little question.
    I have system something like this ( and want to import it to my raspb.
    I control leds by arduino (with processing ide) from my windows pc. So if I use my sketch instead of your test sketch on raspberry pi, will it work ? It may be silly question but I don’t have too much information on these subjects.

  14. Awesome! Everything worked the first time as described (with processing 2.2.1). I’ve never been so happy to see a blinking led.

  15. Thanks Stewart for you excellente guide!!
    I´ve just managed to run my sketch on my Pi B+, on Raspbian release 2015-02-16. I downloaded and installed Java 7.
    My sketch listens to /dev/ttyUSB0 and displays temperature and humidity values sent every 2 seconds by an Arduino Uno board (DCcduino Uno actually) and dth22 sensor.
    Its not my own development as it is based on this article:

    Every thing is running smoothly!! I will atempt to export it as a standalone app.

    Thanks again!

  16. Hello–
    Your tutorial was quite thorough and I got Prcessing 2.2.1 up and running on mt RPi 2 B. Got it to println to the IDE output bottom area with some text just to test it out. All fine so far. But (you knew that word was coming next didn’t you? 🙂 ) I had a problem which I resolved. When I initially attempted to run a sketch I could not get past an error indicating that it could not find ~processing-2.2.1/java/bin/java. Checking I noticed that the java folder was actually a link to the jdk-7-oracle-armhf. Couldn’t figure out why it wouldn’t link so I copied the content of the …armhf folder into a java folder in processing-2.2.1 and it then ran fine. The problem that I have not been able to resolve is getting the “most boring program” attempt to “println(Serial.list());” The sketch runs without errors … but I do not get a list of available serial ports (/dev/ttyACM0 e.g.) just an empty output area. I did the jssc.jar replacement thing several times , rebooted — all to no effect. Any ideas?
    Thanks again for the tutorial..

  17. i followed ur instructions but when i try to run processing it says

    couldnot found required fonts pls reinstall processing

  18. Go to Download \ and get the Linux 32-bit version. It’s big; about 100 MB. I’m going to install it in my home directory, so the base path will be ~/processing-2.1. Extract it:

    Sorry i am new to linux and rpi. What do u mean by saying go to download/….etc? I cannot underestand the step to download it and then install it. Every step seems to be clear except this one.
    Could you please explain further?
    Thanks in advance my friend.

  19. Thank you very much for your spending time but i still dont underestand.
    I thought i should download it threw command line like..wget http://link.
    You mean that i can download it to the raspberry from a browzer?if yes which browzer? The raspberry browzer?

  20. Hi, there was no problems to download firmata sketch to arduino. And there was no problems set arduino.digitalWrite(pin,Arduino.HIGH) or another.
    I have probles with DHT sensor, which send data in bit’s.
    Have you any ideas or solves of this issue?

  21. Hey, have you tried to run processing 3 on a raspberry 2 ?


  22. Thanks a lot. It did work perfectly. Initially I was thinking to make a python program so I can control my arduino, but then I chose this method because I already had the sketch on my windows machine, so why not port it.

Leave a Reply

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