Practical Coding in Java

Learn to write and validate your own code

Darren Kessner, PhD

(revised January 9, 2026)

Previous: Appendix B: Processing Libraries

Using the Processing libraries: CLASSPATH

In order to use the Processing libraries from Java, your Java tools need to be able to find the Processing libraries (the .jar files).

The Java tools read the CLASSPATH environment variable, which contains a list of folders and .jar files in which to search for class definitions.

Mac / Linux

On Mac, the default installation location for Processing is /Applications. In this case, you want to set your CLASSPATH with the following command:

export CLASSPATH=.:/Applications/Processing.app/Contents/app/*

Note that the CLASSPATH value is a list of file paths separated by colons, starting with . so that the Java tools find the classes in your current directory.

To check your CLASSPATH value:

echo $CLASSPATH

On Linux (or Mac with a different installation location), adjust the command accordingly.

The environment variable will disappear when you close your console window. In order to set your CLASSPATH automatically when you open a new console window, include the export CLASSPATH command in your .zshrc (or .bashrc) file in your home directory.

Windows

On Windows, you still want to include the path to your Processing installation .jar files in your CLASSPATH, but the syntax is slightly different:

set CLASSPATH=.;C:\Users\drkessner\path\to\processing-4.x.x\core\library\*

Note that file paths are separated by semicolons, rather than colons.

To check your CLASSPATH value:

echo %CLASSPATH%

To set the CLASSPATH automatically for all new console windows, you can add or edit the CLASSPATH environment variable in the system settings.


Next: