Adding Processing's core.jar to VS Code

Hello!
I’m somewhat new to processing and have only used it in IntelliJ / Eclipse, yet I’m trying to configure it inside VSCode. Adding core.jar into referenced libraries allows the program to be run, yet VSCode complains about every variable instance (pMouseX, pMouseY) of processing being used, even the import line.
for example, the import statement will tell me that “package processing.core does not exist

another example is with an extends call, where it says “cannot find Symbol: class PApplet

Does anyone know how to solve this? Thank you!

Hi @techsupport2544 and welcome to the forum!

Though it doesn’t exactly answer your question, I wanted to mention there is an official Processing extension for VS Code:

I would but it is for a requirement that I must use .java files and not rather .pde, hence why I’m trying to import it. Thanks for the idea though, I’ll consider using it on other projects

In that case, Gradle is probably the most convenient option. You can look at the template found here:

https://github.com/processing/processing4/tree/main/java/gradle/example (This is for .pde files but it shouldn’t be too hard to make it work for .java files)

More instructions here: https://github.com/processing/processing4/tree/main/java/gradle

Note that Processing core libraries are published on Maven central:

https://central.sonatype.com/artifact/org.processing/core

Ok I did a bit more digging (with suggestions from Claude Opus 4.7) and the following worked for me:

Project layout

my-sketch/
├── build.gradle.kts
└── src/
    └── main/
        └── java/
            └── MySketch.java

build.gradle.kts

plugins {
    java
    application
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("org.processing:core:4.5.3")
}

application {
    mainClass.set("MySketch")
}

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(17))
    }
}

src/main/java/MySketch.java

import processing.core.PApplet;

public class MySketch extends PApplet {

    public static void main(String[] args) {
        PApplet.main("MySketch", args);
    }

    @Override
    public void settings() {
        size(800, 600);
    }

    @Override
    public void setup() {
        background(0);
    }

    @Override
    public void draw() {
        fill(255);
        noStroke();
        ellipse(mouseX, mouseY, 40, 40);
    }
}

Run with gradle run.

Thanks Raph! The Gradle Plugin also works with .java files out of the box!