With the latest Processing version 3.0 there are premade binaries you can download and easily install.  There's no need to install Java or other dependencies as they're now included in Processing.

From the Processing download page pick the Linux ARMv6hf release (highlighted below):

(if you're curious the ARMv6hf name stands for the ARMv6 architecture with a hardware floating point unit, i.e. the architecture of the Raspberry Pi)

Once downloaded copy the .tgz to the Pi.  You can actually download the file directly to the Pi by connecting to the Pi's command line terminal and running:

cd ~

This will download the 3.0.1 release to the home directory for the Pi user.  Note that version 3.0.1 is currently the latest version of Processing, but be sure to check the Processing website to see if a later version is available and download it instead of 3.0.1.

Once the file is on the Pi, run the following command to extract it:

tar xvfz processing-3.0.1-linux-armv6hf.tgz

This will extract Processing to a processing-3.0.1 subdirectory.  That's all you need to do to install Processing on the Pi!


To run processing you'll need to use the Pi's graphical desktop environment.  The easiest way to run the Pi's desktop is to enable the Pi to boot directly to the desktop instead of a text console.  Use the raspi-config tool and enable the Boot to Desktop mode (specifically the boot to desktop and autologin as Pi user option on newer Raspbian versions), then reboot the Pi.  You should see the Pi's graphical desktop environment displayed on the Pi's HDMI output.

Inside the graphical environment open the Terminal application and run the following commands to change to the directory Processing was downloaded (in the previous section) and run it:

cd ~/processing-3.0.1/

Processing's splash screen should pop up, then after a few moments the IDE will load:

Now you can use Processing just like using it on your computer.  Type in or load a sketch, click the run button, and watch your sketch execute on the Raspberry Pi.

Running a Sketch Without the Editor

In the previous section you saw how to run Processing and use its editor to create and run a sketch.  However you might find it more useful to run a sketch directly on the Pi without using the editor.  This is great for small displays like the PiTFT where using the Processing editor isn't easy.  You can also use this to run a sketch from a command terminal outside the graphic environment (like when connected to the Pi using SSH).

First make sure the graphical desktop environment is running.  Even though you aren't logging in and running commands in the desktop it still needs to run to show the Processing sketch.  Remember you can have the desktop automatically start on boot using the raspi-config command in the previous section (be sure to set the pi to boot and automatically log in).

Next copy your Processing sketch code to the Pi.  Remember a Processing sketch includes both a .pde file with the code and the directory that contains the .pde file.  For example a Processing sketch called HelloWorld would have a directory called HelloWorld and a file inside that directory called HelloWorld.pde.  Copy that directory and the files inside it to the Pi.

You can use a tool like FileZilla to connect to the Pi using SFTP and copy over files from your computer.  For example here's a picture of uploading a sketch called HelloWorld from my ProcessingSketchbook folder on my computer to the /home/pi folder on the Pi:

Once the sketch is copied over connect to a command line terminal on the Pi.  Run the following command to change to the directory that Processing was installed and use its special processing-java command to run a sketch outside the editor:

cd ~/processing-3.0.1/
DISPLAY=:0 ./processing-java --sketch=/home/pi/HelloWorld --present

There are a few important parts of the command above:

  • DISPLAY=:0 is setting the DISPLAY environment variable to the value :0 which is the address of the graphical desktop.  Programs run inside the graphical desktop will already see this value set, but when you're not running inside the desktop you need to explicitly set the variable like this.
  • ./processing-java is calling the processing-java executable.  This is a special command line version of Processing that can run a sketch without using the editor.
  • --sketch=/home/pi/HelloWorld is a parameter that points to the location of the sketch to run.  In this case a HelloWorld sketch that was copied to the /home/pi location on the Pi.  You can run a different sketch by changing the location of this parameter.
  • --present is a parameter that tells Processing to run the sketch and display it on the screen.  This needs to be the latest parameter in the call.

Note that it will take a little bit of time for the sketch to start running.  To stop the sketch press Ctrl-c in the terminal that started it.

Run Sketch Fullscreen

To run a sketch in fullscreen you can use the new fullScreen function in Processing 3.0.  This is especially useful for running a sketch on a small display like the PiTFT.  Just replace the call to size() in the setup function with a call to fullScreen().  

In addition you might want to add a call to the noCursor() function in the setup to hide the mouse cursor.

PiTFT Limitation

If you're using the PiTFT to display a sketch one thing to be aware of is that Processing's 3D-accelerated renderers are not directly supported.  Specifically the P2D and P3D renders won't work with the PiTFT.  This is because the Pi's graphics processor outputs to the HDMI port and not the PiTFT.

If you're an advanced user you can potentially look at using the fbcp tool to copy the output of the Pi's HDMI port to the PiTFT.  See this guide for using fbcp to play 3D accelerated application on the Pi for information on using fbcp.  This is a fairly advanced procedure and requires compiling and installing fbcp from its source.

Another option to see 3D-accelerated graphics is to use a small HDMI monitor or television.  Remember the Raspberry Pi is not as fast as your desktop computer or laptop so it won't be able to display complex animations or graphics!

Disable Screen Blanking

If you run a Processing sketch for a while without any input you might find the monitor turns off and goes blank.  You can prevent this behavior by editing a desktop environment configuration file.

In a command terminal run this command to edit the /etc/lightdm/lightdm.conf configuration file:

sudo nano /etc/lightdm/lightdm.conf

Then scroll down to the [SeatDefaults] line and change the #xserver-command=X line beneath it to look like:

xserver-command=X -s 0 -dpms

The file should look like the following image:

Then save the file by pressing Ctrl-o then enter, and then Ctrl-x.  Reboot the Pi and the change should take affect and prevent the monitor or PiTFT from turning off.

This guide was first published on Nov 13, 2015. It was last updated on Jun 09, 2024.

This page (Processing) was last updated on Nov 09, 2015.

Text editor powered by tinymce.