How to use Processing 3d in IntelliJ using core library?

i have this code:

import processing.core.PApplet;

public class Main extends PApplet {

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

    public void setup() {
    }

    public void draw() {
        background(51);
        stroke(255);
        noFill();

        translate(width/2, height/2);
        box(300);
    }

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

But when i run the code i get a very long error saying:

java.lang.NoClassDefFoundError: com/jogamp/opengl/GLException
	at processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:712)
	at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:569)
	at processing.opengl.PGraphics3D.<init>(PGraphics3D.java:35)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at processing.core.PApplet.makeGraphics(PApplet.java:2235)
	at processing.core.PApplet.createPrimaryGraphics(PApplet.java:2314)
	at processing.core.PApplet.initSurface(PApplet.java:10828)
	at processing.core.PApplet.runSketch(PApplet.java:10767)
	at processing.core.PApplet.main(PApplet.java:10504)
	at processing.core.PApplet.main(PApplet.java:10486)
	at Main.main(Main.java:22)
Caused by: java.lang.ClassNotFoundException: com.jogamp.opengl.GLException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 14 more
java.lang.RuntimeException: com/jogamp/opengl/GLException
	at processing.core.PApplet.makeGraphics(PApplet.java:2268)
	at processing.core.PApplet.createPrimaryGraphics(PApplet.java:2314)
	at processing.core.PApplet.initSurface(PApplet.java:10828)
	at processing.core.PApplet.runSketch(PApplet.java:10767)
	at processing.core.PApplet.main(PApplet.java:10504)
	at processing.core.PApplet.main(PApplet.java:10486)
	at Main.main(Main.java:22)

Can anyone help me fix this?

Welcome @Eliott

Are you using Linux? Does inserting this System.setProperty line help?

    public void settings() {
        System.setProperty("jogl.disable.openglcore", "false");
        size(800,600, P3D);
    }

You’re missing some JOGL dependencies by the look of it.

You could also try the Gradle examples for libp5x - Libp5x examples - Processing, LWJGL, Gradle and Java 11+ modules