How to use Processing 3 on IntelliJ IDEA?

ypicard picture ypicard · Apr 21, 2016 · Viewed 16.8k times · Source

I'd like to use the IntelliJ IDEA IDE to develop some app using Processing 3. How can I do that ?

There are only tutorials on how to use Processing 2, but I think things have changed enough so that those tutorials do not work anymore.

Thank you

Answer

Kevin Workman picture Kevin Workman · Apr 21, 2016

It's hard to answer general "how do I do this" type questions. Stack Overflow is designed more for "I tried X, expected Y, but got Z instead" type questions. You'll have much better luck if you try something out and post an MCVE along with a specific question if you get stuck. You say you think things have changed enough so that those tutorials don't work anymore- could you test that assumption by trying it out?

Because those tutorials will still work. A few things have changed, such as the removal of the ability to embed a PApplet directly into a Swing application. But 90% of the rest of the tutorials should work fine.

Step 1: Add the Processing library to your classpath. This includes the core and any JOGL dependencies you need.

Step 2: Create a class that extends PApplet and add your code there.

Step 3: Call PApplet.main("YourSketchNameHere"); to launch your sketch.

Here is a little example that shows those steps:

import processing.core.PApplet;

public class ProcessingTest extends PApplet{

    public void settings(){
        size(200, 200);
    }

    public void draw(){
        background(0);
        ellipse(mouseX, mouseY, 20, 20);
    }

    public static void main(String... args){
        PApplet.main("ProcessingTest");
    }
}

Please try something out and post a specific question if you get stuck. Good luck.

Shameless self-promotion: I wrote a tutorial on using Processing as a Java library, available here.