Skip to content

Latest commit

 

History

History
205 lines (125 loc) · 9.09 KB

BUILD.md

File metadata and controls

205 lines (125 loc) · 9.09 KB

How to Build Processing

Great to see you are interested in contributing to Processing. To get started you will need to have an IDE to build and develop Processing. Our recommendation and what we use ourselves is Intellij IDEA.

IntelliJ IDEA (recommended)

Note: A paid subscription is not required. Everything needed to build and work on Processing is available for free in IntelliJ IDEA.

  1. Download IntelliJ IDEA and install it.
  2. Install Rust. It is needed to build libprocessing, the native library behind the WebGPU renderer.
  3. Clone the processing4 repository locally, including its submodules (git clone --recursive, or git submodule update --init --recursive in an existing clone).
  4. Open the cloned repository in IntelliJ IDEA.
  5. When prompted, select Trust Project. (You can preview the project in Safe Mode, but you will not be able to build Processing.)
  6. If IntelliJ asks whether to import the Gradle project, select Load Gradle Project.
  7. Make sure IntelliJ and Gradle are both using JDK 25:
    • Go to File > Project Structure > Project
    • Set Project SDK to JDK 25 (we recommend Eclipse Temurin)
    • If needed, choose Download JDK… and install Version 25
    • Then go to Settings > Build, Execution, Deployment > Build Tools > Gradle
    • Set Gradle JVM to the same JDK 25 (the project requests 25 in gradle/gradle-daemon-jvm.properties, so this is usually picked automatically)
  8. Wait for Gradle sync to finish.
  9. Click the green Run button in the top right to build and launch Processing. You can also use this menu to start a debug session.

Tip

If you encounter any issues with this process, Read the Troubleshooting and Setup Tips for IntelliJ IDEA

Logs can be found in the Build or Debug pane on the bottom left of the window.

VSCode

  1. Clone the Processing4 repository to your machine locally
  2. Open the cloned repository in VScode
  3. Wait for Gradle to set up the repository
  4. (If you want debugging install Debugger for Java and Java Extension Pack)
  5. Go to the Gradle Tab and click app -> Tasks -> compose desktop -> run

Instructions for other editors are welcome and feel free to contribute the documentation for those here

Other Editors

TBD

Command Line

If you prefer not to use an IDE, you can also build Processing directly from the command line.

Set Up the Environment

If you don't have them installed, you will need to install Git, Gradle and Rust first. Then follow these steps:

  1. Clone the repository:

    git clone --recursive https://github.com/processing/processing4.git
    cd processing4
  2. Install Temurin JDK 25:

    Download and install the appropriate version for your platform from Adoptium, or use a package manager:

    brew install --cask temurin@25                         # macOS
    winget install --id=EclipseAdoptium.Temurin.25.JDK -e  # Windows

    SDKMAN! is also a useful tool for developers working on multiple versions of the JVM.

  3. Set the JAVA_HOME environment variable:

    It may be necessary to set the JAVA_HOME environment variable to point to your Temurin JDK installation.

    export JAVA_HOME=/path/to/temurin/jdk-25/
  4. (Optional) Install jextract:

    jextract generates the Java bindings for libprocessing. The build downloads it automatically, but if you already have it installed (for example with sdk install jextract), that copy will be used instead.

Build, Run, and Package Processing

Build the Project (Required First Step)

This compiles the source code and prepares everything needed to run or test Processing:

./gradlew build

Run Tests

Run unit tests and verify your build:

./gradlew test

Launch Processing

Start the Processing Development Environment (PDE):

./gradlew run

Create a Distributable Package (Optional)

Generate a packaged version of Processing, ready for distribution:

./gradlew package

The packaged files will be available in the app/build/compose/binaries directory.

Architecture

Processing consists of three main components: Core, Java, and App. The Core is independent, while Java and App depend on it. Currently, Java and App are interdependent, but efforts are underway to decouple them.

  • Core: The essential code included with your sketches that provides Processing’s basic functions. When you use functions like ellipse(25,25,50,50) or background(255), their underlying code is part of Core.

  • Java: The part of Processing that compiles and runs .pde files. It supports different modes which implement support for different languages or versions of Processing. The default mode is Java.

  • App: This is the Processing Development Environment (PDE), the visual part of the editor that you see and work within when you use Processing.

Examples

  • You want to fix a bug with one of the argument of a function that you use in a sketch. The Core is probably where you would find the implementation of the function that you would like to modify.
  • A bug of the PDE editor has been keeping you up at night, you would likely find the relevant code in the App section of this project.
  • If you've written a large sketch and Processing has become slow to compile and run it, a place to improve this code can most likely be found in the Java section.

User interface

Historically, Processing's UI has been written in Java Swing and Flatlaf (and some html & css). Since 2025 we have switched to include Jetpack Compose. It is backwards-compatible with Swing, which allows us to gradually replace Java Swing components with Jetpack Compose ones, instead of doing a complete overhaul of the editor.

Build system

We use Gradle as the build system for Processing. Until 2025, Processing used Ant but we have switched to Gradle to be more in line with modern standards. We plan to migrate the internal build system of the Java mode to Gradle as well, unifying both systems for simplicity.

Kotlin vs Java

With the introduction of the Gradle build system we now support Kotlin within the repository. Refactors from Java to Kotlin are not necessary at this stage, but all new functionality should be written in Kotlin.

Any classes that end up being written in Kotlin have their equivalent Java class under app/ant/ source directory.

Running Processing

The main task to run or debug the PDE is run. That means you just need to run ./gradlew run (Linux) or ./gradlew.bat run (Windows) to build and run Processing.

If your main concern is with the Core you don't need to build and start the whole PDE to test your changes. In IntelliJ IDEA you can select any of the sketches in core/examples/src/.../ to run by click on the green arrow next to their main functions. This will just compile core and the example sketch. Feel free to create additional examples for your new functionality.

If you are specifically trying to run the Processing CLI, you can test commands from app/test/Processing.app/CLITest.

Troubleshooting and Setup Tips (IntelliJ IDEA)

If you’re building Processing using IntelliJ IDEA and something’s not working, here are a few things that might help:

Use the Correct JDK (temurin-25)

Make sure IntelliJ is using temurin-25, not another version.

  1. Go to File > Project Structure > Project
  2. Set the Project SDK to: temurin-25 java version "25"

JDK Selection

If it is not already installed, you can download it by:

  1. Clicking the SDK input field and then selecting the Download JDK... option from the menu
  2. Select Version: 25, Vendor: Eclipse Temurin (AdoptOpenJDK HotSpot)
JDK Download

JDK Download

Now go back to your main window and

  1. Click the green Run Icon in the top right of the window.

“libprocessing submodule directory not found”

The libprocessing submodule hasn't been checked out. Run:

git submodule update --init --recursive

“Duplicate content roots detected”

You may see this warning in IntelliJ:

Duplicate content roots detected: '.../processing4/java/src'

This happens because multiple modules reference the same source folder. It’s safe to ignore.

Build Failed

If the build fails with Permission denied or Could not copy file errors, try cleaning the project.

Run:

./gradlew clean

Then, rebuild the project.