Here's a quick guide to get Processing working without the desire to wrap one's car around a tree due the sheer verbosity and inflexibility of a language.
A sneak:

Make sure Java's installed
[mchadw@zzz ~]$ which java
/usr/bin/java
Snag jRuby
- Download a recent copy of jRuby. Whatever the most recent binary on that page is will do the trick.
- Unpack the distribution somewhere you can remember. I'm going to go with ~/bin
cd ~/bin
tar -xzvf jruby-bin-1.0.0RC1.tar.gz
cd jruby
echo "5.times{|i| puts i}" | ./bin/jruby
If everything went to plan, you should see the expected output.
Grab Processing
- Download from processing.org. Each platform's going to be different, so snag the one that's right for you.
- Extract the file, and put it someplace where we'll know to find it. Let's say we'll also throw it in
~/bin-- but just like jRuby, it doesn't really matter where.
Fix ye Path
- Real quick -- you're going to want to open your
~/.bash_profileand let it know about jRuby's silly "install." Just add a line like this:
export PATH=$PATH:~/bin/jruby/bin
That'll just make sure we don't have to track the damn thing down every time.
Set your Classpath, fire it up.
The only real trick here is making sure processing's core.jar is in your classpath.
export CLASSPATH=$CLASSPATH:~/bin/Processing\ 0124/lib/core.jar
Now we should be able to make some simple processing applets. Here's the code for the 3D RGB cube:
#!/usr/bin/env jruby
require "java"
include_class "processing.core.PApplet"
class Sketch < PApplet
def setup
size 300, 300, P3D
no_stroke
color_mode RGB, 1
@xmag = 0
@ymag = 0
@newXmag = 0
@newYMag = 0
end
def draw
background 0.5, 0.5, 0.45
push_matrix
translate(width/2, height/2, -30)
@newXmag = mouseX/width.to_f * TWO_PI;
@newYmag = mouseY/height.to_f * TWO_PI;
diff = @xmag - @newXmag
if (diff.abs > 0.01)
@xmag -= diff/4.0
end
diff = @ymag - @newYmag
if (diff.abs > 0.01)
@ymag -= diff/4.0
end
rotateX -@ymag
rotateY -@xmag
scale(50)
begin_shape(QUADS)
fill(0, 1, 1); vertex(-1, 1, 1)
fill(1, 1, 1); vertex( 1, 1, 1)
fill(1, 0, 1); vertex( 1, -1, 1)
fill(0, 0, 1); vertex(-1, -1, 1)
fill(1, 1, 1); vertex( 1, 1, 1)
fill(1, 1, 0); vertex( 1, 1, -1)
fill(1, 0, 0); vertex( 1, -1, -1)
fill(1, 0, 1); vertex( 1, -1, 1)
fill(1, 1, 0); vertex( 1, 1, -1)
fill(0, 1, 0); vertex(-1, 1, -1)
fill(0, 0, 0); vertex(-1, -1, -1)
fill(1, 0, 0); vertex( 1, -1, -1)
fill(0, 1, 0); vertex(-1, 1, -1)
fill(0, 1, 1); vertex(-1, 1, 1)
fill(0, 0, 1); vertex(-1, -1, 1)
fill(0, 0, 0); vertex(-1, -1, -1)
fill(0, 1, 0); vertex(-1, 1, -1)
fill(1, 1, 0); vertex( 1, 1, -1)
fill(1, 1, 1); vertex( 1, 1, 1)
fill(0, 1, 1); vertex(-1, 1, 1)
fill(0, 0, 0); vertex(-1, -1, -1)
fill(1, 0, 0); vertex( 1, -1, -1)
fill(1, 0, 1); vertex( 1, -1, 1)
fill(0, 0, 1); vertex(-1, -1, 1)
end_shape
pop_matrix
end
end
JFrame = javax.swing.JFrame
frame = JFrame.new "RGB Cube"
applet = Sketch.new
frame.content_pane.add applet
frame.default_close_operation = JFrame::EXIT_ON_CLOSE
applet.init
frame.pack
frame.visible = true
Grab it here if you can't work copy/paste
Reflect on Life's finer points
So, yeah. You'll see we had to set up the applet window by hand, but besides that, not all so bad. I didn't Rubify any of the java code, so it's all still a bit ugly still. But! It works! Now, go write yourself a wrapper library to make this garbage look clean.
