This post updates Toxi's post about integrating Processing (Alpha) with Eclipse. The text is by Toxi and edited by REAS. Let us know in this post if there are errors in these instructions.
Eclipse is an open source environment with all sorts of luxurious features like code hints and completion, error checking as you type, intelligent refactoring (renaming), javadoc generation etc. It's all quite heavyweight, but in short, it just ROCKS and above all, once setup correctly it works like a charm with the Processing libraries (as expected : ) !
If you feel you have slightly outgrown the PDE and are interested to check out eclipse, below are the steps to set you all up & running...
Before starting, make sure you have Eclipse working correctly. It's not easy, so make sure you have some of their tutorials working before tying to bring Processing in. http://www.eclipse.org/
1) If you haven't done so yet, download and install a recent version of the JavaSDK (v1.4.x or newer) from Sun's website
2) Go to the Eclipse download page and select latest stable build (3.0.2 as at time of writing). On the next page select "Eclipse SDK" (including the Java Development Tools). You'll need them as Eclipse itself is a very flexible IDE and is using plugins to handle various development types. The JDT plugins are needed for using eclipse with java.
3) Once installed (for Windows I recommend directly into C:\eclipse) - launch eclipse and select "new project" from the "file" menu. Select "java" and then "next". Now give a name to the project, eg. "HelloP5" and click on "next" again. In the new dialog, click on the "libraries" tab. You should see a list of installed JREs. However we need to manually add the Processing libraries. So select "add external JARs" and open the "lib" folder of your processing application (eg. C:\processing-0090\lib). Select "core.jar". Press "finish" to setup the project folders and confirm that this project will use the "java perspective".
4) By now you should see the interface has changed to the java perspective, with the "package explorer" on the left. For some good housekeeping, lets create a subfolder for storing all source files independently from the exported classes. Select "file menu > new > source folder" and use "src" as the folder name. Click "ok" to confirm. A new icon for that folder should now appear in the package explorer. please select it.
5) In order to write some code we first need to create a new class, so select "file menu > new > class" and name give it a name, eg. "HelloP5". (Note: for the later parts of this tutorial to work, you should name this class like your project name). Ignore the other options in that dialog for now and just press "ok". You'll see Eclipse opened the new source file for you and has filled in some basic default class definition code already.
6) If you ever had a look at the exported java file the Processing PDE is generating, you'll have seen that all your sketches are implemented as sub-class of the almighty PApplet. Eclipse can't know about that fact, so we'll have to tell it the compiler ourselves by adding "extends PApplet" to the class definition. here's some example code:
Code:
import processing.core.*;
public class HelloP5 extends PApplet{
public void setup(){
size(200, 200);
stroke(155,0,0);
}
public void draw(){
line(mouseX,mouseY,width/2,height/2);
}
}
7) Save the changes to the file and select "Run..." from the "Run" menu. Choose "java applet" and press "new" to create a new setting. The wizard will fill in all the necessary fields apart from the window dimensions, which default to 200 x 200 pixels. If your sketch is using anything different, you'll need to edit the settings under the "parameters" tab. Click "apply" and then "run". BTW, this step is only needed once per sketch, you can also run the currently selected sketch by pressing CTRL+F11.
8 ) If everything's setup correctly, you should now see your sketch in the java applet viewer.