Monday, 29 March 2010

Processing in Netbeans

If you've ever browsed the Processing learning section you may have seen the article showing how to use Processing from within Eclipse.
How, I'm more of a Netbeans fan myself. This isn't a criticism of Eclipse, which I also use extensively. I just like Netbeans. Therefore, I'd like to share how to get Processing working from within the Netbeans IDE. I'll assume that you already have an installation of the Processing IDE. This howto is based almost directly on the Eclipse tutorial, so differences should be obvious.

Step 1. Download and install Netbeans

Netbeans can be downloaded from Any of the bundles that contains Java SE will do. I use the 'All' bundle but you can get away with a smaller one.

Step 2. Create a new project

Ctrl-Shift-N creates a new project. For the project type, select Java >> Java Application. On the next page of the New Project dialog, give your project a name; I used 'ProcessingTest'. Also tick 'Create Main class' and enter a new like ''. You should use your own domain (this style of using a backward domain to create a unique namespace is common within java).

Step 3. Import the Processing library

To tell Netbeans about how Processing works, we need to import the Processing core library. Expand the 'ProcessingTest' project and then expend 'Libraries'. There should be one entry already, for the JDK. Right-click on the Libraries icon and select 'Add JAR/Folder...'. Browse wo where you installed the Processing IDE and then descend into the lib folder. Select 'core.jar'.

Step 4. Create a class and write your code!

Ctrl-N opens the New File dialog. Select 'Java Class' and give the class a name like 'MyProcessingSketch'. I'm going to use the same code as the Eclipse example;

import processing.core.*;

public class MyProcessingSketch extends PApplet {

  public void setup() {

  public void draw() {
    if (mousePressed) {

Step 5. Run!

Before we can run this code, we need to modify the Main class that Netbeans already created. Modify the code as follows:

import processing.core.PApplet;

public class Main {

    public static void main(String[] args) {
        PApplet.main(new String[] {"--present", ""});
Press F6 to execute the code. Your screen should switch to Processing running in fullscreen mode and the middle section should allow you to draw on it.


  1. Thank you for posting this tutorial, it was very helpful.


  2. Thank you very much, greetings from Colombia!

  3. thank you, very helpful!

  4. Thank you very much. This tutorial was very helpful to me.

  5. good job finally worked all the other tutorials were lame!