Ubuntu 12.04: How to Install Processing

Processing can be downloaded and installed from Processing.org. As the supported platforms page in the Processing Wiki indicates, installation on Linux can be complicated.

In the following instructions, I’m going to assume you have a basic acquaintance with the Terminal and command lines, at least enough to get around the operating system. This is a really useful skill to acquire in Linux (and MacOS) and can improve your abilities as a programmer. In any case, if you can open a Terminal, you can probably get through the instructions here and on the pages I link to. You will need admin access to run some of the commands, specifically those that begin with sudo.

First, download Processing. On Ubuntu 12.04, the 64-bit architecture is appropriate. It downloads as a .tgz archive, typically into the Downloads folder in your Home folder. You can extract the archive by double-clicking in Ubuntu’s file system browser or extract it from the command line in a Terminal with tar -xf processing-2.2.1-linux64.tgz. Once you have extracted the folder processing-2.2.1, you’ll need to decide where to locate it. I created a new directory, Developer, in my Home Folder, and moved Processing to it just by dragging and dropping. You could also install Processing in the /opt/ folder, though this requires an admin account and use of the Terminal.

If Processing just ran out of the box, you could double-click and run the processing script in the processing-2.2.1 folder or point a Terminal to the folder and type ./processing and hit return (the latter is the approach I recommend). That is unlikely to work because of incompatibilities with the downloaded version of Java in Processing and the default Java environment on Ubuntu. You can resolve the incompatibilities in two steps: installing a new version of Java and adjusting Processing’s directory structure. After reading the supported platforms page in the Processing Wiki, I decided that it made the most sense to install Oracle Java 7.

Installing Oracle Java 7

Information on issues with Java can be found in Ubuntu Help. Take a moment to read the section on Oracle Java 7. Because of licensing issues, Java has to be downloaded and installed from Oracle. Fortunately, there is a tool to simplify this process at webupd8.org. The documentation is clear and simple, and I leave you to it. Once you’ve installed Java, run the Java environment variables installer, too. FWIW, here is my command history for this process:

35 java -version
36 sudo add-apt-repository ppa:webupd8team/java
37 sudo apt-get update
38 sudo apt-get install oracle-java7-installer
39 java -version
40 sudo apt-get install oracle-java7-set-default
41 update-alternatives --display java

Adjustments to Processing

Once you have Oracle Java 7 installed and set as the default version of Java in Ubuntu, you’ll still need to modify Processing to use the newly installed version instead of its own. First, copy Processing’s fonts to the newly installed version of Java. You’ll have to change the command lines to reflect the directory structure for your particular installation of Processing. Oracle Java 7 directories should be the same.

cd /usr/lib/jvm/java-7-oracle/jre
sudo cp -R '/home/ignotus_mago/Developer/processing-2.2.1/java/lib/fonts' lib

Next, in your Processing directory, rename the java folder.

cd '/home/ignotus_mago/Developer/processing-2.2.1'
mv java java_old

Now create a symbolic link (symlink) to Oracle 7 Java’s java binary:

ln -s /usr/lib/jvm/java-7-oracle/jre java

At this point, you should be able to run Processing from the Terminal with ./processing. It works for me. YMMV, but I suspect that it should work in most cases. Getting all of Processing’s libraries up and running and getting Processing to run in the Eclipse IDE in Ubuntu are topics I expect to tackle later.