Cover by Ben Fry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Chapter 11. Integrating Processing with Java

Processing is not Java. If you're a Java developer, using Processing may be confusing if you expect it to be too much like Java. If this book is your first introduction to Processing, you are strongly urged to first get used to the Processing way of doing things as presented in the first several chapters. It'll be easier to adapt to using the Processing API inside a Java project once you've developed a mental model for how the API works and how Processing sketches are structured.

The Processing syntax is essentially a dialect of Java. When a user runs a sketch in the PDE, the code is converted into Java syntax using a preprocessor, and then compiled as standard Java code. The implementation of all Processing Core API functions can be found in the package processing.core, which is stored in the core.jar file found in the lib folder of your Processing distribution. All Processing sketches subclass the PApplet class from the processing.core package.

The Anemone example in Chapter 8 shows how to use processing.core inside the Eclipse development environment. It also covers some of the basics of embedding Processing in other Java-based projects. The methods used should be familiar to most Java programmers, and they can be adapted to other development setups and IDEs.

This chapter is intended as a reference for Java programmers who want to understand how to integrate Processing with Java code and for Processing developers who are ready to break ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required