04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Returning to <strong>Processing</strong>—your launched <strong>Processing</strong> program is being run by the built-in<br />

JVM on your computer as a regular Java application. <strong>Processing</strong> sketches, however, are<br />

written within the <strong>Processing</strong> environment, or from within the running Java application.<br />

How can the sketches you write be compiled <strong>and</strong> then launched by Java if Java is already<br />

being used to run the <strong>Processing</strong> application? This is a good question (if I do say so<br />

myself). If you look within the <strong>Processing</strong> application folder, you’ll notice something called<br />

jikes (see Figure 5-1).<br />

Figure 5-1. Screen capture of the <strong>Processing</strong> application folder<br />

THE PROCESSING ENVIRONMENT<br />

This is not an exclamation, as in “Holy jikes!” but rather an open source, free Java compiler<br />

from IBM. Compilers take the higher-level code we humans write <strong>and</strong> convert it to a<br />

lower-level language that machines like. In some languages, like C <strong>and</strong> C++, compiling<br />

converts your program code to a very low-level machine code that is specific to your operating<br />

system. So compiling C code on a Mac yields different machine code than compiling<br />

the same code on Windows. However, in Java <strong>and</strong> <strong>Processing</strong>, the compiled Java code,<br />

called bytecode, will be the same on any platform; <strong>and</strong> it is the interpreter, or JVM, that is<br />

responsible for translating the bytecode for your specific operating system. If you want to<br />

learn a little more about jikes, check out http://jikes.sourceforge.net/. In the st<strong>and</strong>ard<br />

JDK from Sun is another complier, javac, which is also free to use, but not open<br />

source.<br />

When you launch the <strong>Processing</strong> application, which already comes compiled, it’s executed,<br />

as I stated before, by the JVM installed on your computer. Your <strong>Processing</strong> sketches, which<br />

you write from within the <strong>Processing</strong> environment, are compiled into Java bytecode (the<br />

class files that the JVM can read) by jikes when you run your sketch. Running your sketches<br />

causes the <strong>Processing</strong> application to open a new display window, which is a relatively<br />

145<br />

5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!