This tutorial is an updated version of Section 12.3: Contributed Libraries. Processing now allows for a “libraries” folder inside your Processing sketchbook, which is a great deal more convenient than having your 3rd party libraries installed in the Processing application folder. Now, when you upgrade to a new version of Processing you don’t have to copy your libraries over.
As of the writing of this book, there are 47 contributed libraries, with capabilities ranging from sound
generation and analysis, to packet sniffing, to physics simulations, to GUI controls. Several of these
contributed libraries are demonstrated in this book’s examples. Here, we will take a look at the process of downloading and installing a contributed library.
Where to install them
First, locate where your Processing sketchbook. This is the default directory of all of your Processing sketches. On a mac, this will usually be:
on a PC, it’s probably:
If it doesn’t already exist, create a folder called “libraries” here. This is where you’ll install the 3rd party libraries. An example of a contributed library is one used with this book: SimpleML, a library for making asynchronous requests for raw data from web pages and/or XML feeds. You can download the library from this link.
How to install them
Step 1. Extract the ZIP file. This can usually be accomplished by double-clicking the file or with any decompression application, such as Winzip on a PC.
Step 2. Copy the extracted files to the Processing libraries folder. Most libraries you download will automatically unpack with the right directory structure. The full directory structure should look like this:
Some libraries may include additional files in the “library” folder, as well as the source code (which is commonly stored one directory up, in the “libraryName” folder). If the library does not automatically unpack itself with the above directory structure, you can manually create these folders (using the finder or explorer) and place the libraryName.jar file in the appropriate location yourself.
Step 3. Restart Processing. If Processing was running while you performed Step 2, you will need to quit Processing and restart it in order for the library to be recognized. Once you have restarted, if everything has gone according to plan, the library will appear under the “Sketch → Import Library.”
What to do once you have installed the library really depends on which library you have installed. Examples that make use in code of a contributed library can be found in Chapter 18 (simpleML, "http://www.learningprocessing.com/tutorials/yahoo">Yahoo API) and Chapter 20 (Sonia, Minim).
(Note that the process for installing other contributed libraries will be identical, with the exception of filenames.)