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!

Hello,

P2D and P3D did not work for me with the configuration provided.

I had to copy the these into a new lib folder in root of sketch folder:

And modify build.gradle.kts:

plugins {
    java
    application
}

repositories {
    mavenCentral()
}

dependencies {
    implementation(fileTree("lib") {
        include("*.jar")
    })
}

application {
    mainClass.set("MySketch")
}

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

:)

Hmm, that’s strange. I don’t have this issue on my end (see the screenshot below)

Great that you found a workaround. At the same time, it kind of defeats the purpose of using Maven Central if you still have to manually add .jar files to the project :sweat_smile:

I wonder what is different about your setup. What does the rest of your project look like and what error message did you get when running the Gradle setup suggested above?

Hello @sableraph,

Please share your:
build.gradle.kts

I did try variations of this (many) that did not work:

dependencies {
    // 1. Processing Core
    implementation("org.processing:core:4.5.3")

    // 2. JOGL & GlueGen (Core + Natives)
    // Version 2.3.2 is reliable on Maven Central for Windows
    val joglVersion = "2.6.0"
    implementation("org.jogamp.jogl:jogl-all-main:$joglVersion")
    implementation("org.jogamp.gluegen:gluegen-rt-main:$joglVersion")
}

Can you expand your external libraries?
Want to see what you have there so we are on the same page.

I am still exploring this.

Thanks!

It’s the same one I shared in my previous message:

plugins {
    java
    application
}

repositories {
    mavenCentral()
}

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

application {
    mainClass.set("MySketch")
}

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

That might be why… I have gluegen and jogl in there. Good catch


@stefterv: Is it meant to work with P2D and P3D? Looks like gluegen and jogl don’t get included by default when importing org.processing:core:4.5.3 from Maven Central.

This reference suggests that they need to be added:

On a positive note I have improved my workflow with VS Code.
Always save files when making changes before running! This caught me off guard a few times and I though it was working.

This worked as well (gets the core and I added requried libs for P2D/P3D) at my end:

:)

That comment pre-dates the Gradle template though, and there’s been a lot of effort going into improving the experience of using Processing outside the PDE, especially thanks to Stef’s work with Gradle, so I should hope there is a way for this setup to work without manually adding .jar files to your project :relieved_face:

Hello @sableraph,

I managed to get it working with this on Windows 10:

:)

is it possible to do without gradle? Or is it designed around it?

Yes.

This was what I did initially:

I had a couple Java versions so had to tell it which one to use.

A couple ways:

You can search for the JAR files to find the correct path.

I may not be using the recommended directory structure since I was just testing.

:)

you didn’t get intellisense errors?

Maven Central: org.processing:core Strange, it does list the dependencies here

@glv I tried with a clean project outside of IntelliJ and it does run for me:

I even did a more isolated build from a temporary Gradle home directory by running:

TMP=$(mktemp -d)
GRADLE_USER_HOME=$TMP gradle run

It redownloaded the dependencies and ran without errors:

Hello @techsupport2544,

In the method here (copy JARs to lib folder) I did not get IntelliSense errors:

These are extensions enable so there are no surprises:

This topic is marked as solved so I will be ending my participation in this.
The solution did not work for me on Windows 10 with P2D/P3D and I have shared my solutions for that environment.

I am still exploring this…

:)