Skip to content

Build Instructions (Updated)

Manindra29 edited this page Feb 22, 2013 · 13 revisions

Build Instructions

Disclaimer : This is an unofficial wiki I've made and not yet verified!

So are you ready to build Processing in its raw form? Dive in!

You require the following components (latest versions obviously):

Setup Environment Variables

You need to set JAVA_HOME for your environment. javac, java and ant should be on your environment's Path. The process of setting up environment variables is different for each platform. ###Windows

  • Windows XP, right-click My Computer → Properties → Advanced → Environment Variables
  • Windows 7, Start → Search "Environment Variables", and click "Edit the system environment variables".
  • Windows 8: Control Panel → Click More Settings on the left →Search "Environment Variables" in Control Panel, and click "Edit the system environment variables".

We need to set two environment variables.

Set JAVA_HOME

Under user variables, click New.

Set Name as: JAVA_HOME

Set value as location to the JDK installation folder. For ex, on our system the value is C:\Program Files\Java\jdk1.6.0_41

Set Path

Double click on Path variable. If a variable named Path doesn’t exist, create a new one and set its name as Path. Set its value as location of JDK’s bin folder. Insert a semi-colon separator too, if multiple paths already exist in the value field. For ex, Add this to the end of value: ;C:\Program Files\Java\jdk1.6.0_41\bin

Log out and log back in for changes to take effect.

###Mac OS X Set JAVA_HOME

To set JAVA_HOME, open Terminal and type:

open /Applications/TextEdit.app/ ~/.bash_profile

Add the following line:

export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home

Save the file, log out and log back in for changes to take effect.

###Linux Set JAVA_HOME

To set JAVA_HOME, open Terminal and type:

sudo gedit ~/.bashrc

Add the following line:

export JAVA_HOME='<path to your jdk installation directory>'

Save the file, log out and log back in for changes to take effect.

Cloning Time!

To grab a copy of the Processing source code to your system, go to Processing GitHub repo. If you see the Clone in Windows/Mac button, click that. If you want to clone via the terminal (git shell for Windows users), type:

git clone https://github.com/processing/processing.git

The repo is kinda big, nearly 1.5 GB. So go take a break while it downloads. Also remember that git's cloning process can’t be paused. If the download gets interrupted midway, you’ll have to clone the full thing again.

##Build It

Now it’s time to build the beast! Open Terminal(git shell for Windows users), from the processing folder, type:

cd build

ant run

It can take a few minutes if you’re building for the first time. You need to be connected to the internet if you're on Windows/Linux. If you did everything correctly, the Processing window should greet you. Cheers!

##Updating to the latest version

The main Processing repo gets updated regularly as the team continues development. To add the latest changes to your clone, cd to processing folder and type:

git pull

git update

If you’re getting build errors after updating, from processing/build folder, type:

ant clean

Try building again. You shouldn't see any more errors.

Building with Eclipse

Disclaimer: Processing is intended to be built with ant. You should always ensure the code compiles with ant before submitting a pull request.

It's a good idea to create a new Eclipse workspace for Processing.

  1. Open Eclipse, select File → Import... Expand the “Git” folder, select “Projects from Git”, and hit the Next button.

  2. On the “Select Repository Source” screen, choose “URI” and enter https://github.com/processing/processing.git And then click Next.

  • If you've already cloned the repo, instead of selecting "URI", select "Local". Click on Add button. Now click browse, navigate to the processing folder(root folder of your clone) and select it. You should see the processing git repo in the list. Hit Next.
  1. Select “Import existing projects” on the “Wizard for project import” page. Hit Next.

  2. Select all the projects shown and finish the wizard.

  3. You'll have several errors, because you need to build the projects once with ant (on the command line: cd /path/to/processing/build && ant) so that the “generated” folder is created. After doing that, select the processing-app project in Eclipse and hit F5 to refresh it.

  4. The android project may be having build errors. Add android.jar file for SDK 10 to the android project's build path.

  5. processing-app project may be having build errors. Add the tools.jar file from <JDK folder>/lib to the project's build path.

  6. Now you can run processing-app > src > Base.java as Java Application.

Notes

  • You'll need to set an ANDROID_LIB classpath variable (Preferences > Java > Build Path > Classpath Variables), that points at the android.jar file for SDK 10. i.e. /path/to/android-sdk/platforms/android-10/android.jar

  • Make sure that you're using a full JDK to build, otherwise you'll get errors about missing com.sun.jdi.* classes. Processing is not compatible with OpenJDK.

  • For bonus points, you can also set processing/build/formatter.xml as the code formatter for your workspace.

  • Make sure the execution environment is set to Java 1.6, since that's what's used for the PDE. There are no plans to move to 1.7 anytime soon.

Fork Us!

If you'd like to contribute to Processing, make sure to fork us! Pull requests are welcome.

Clone this wiki locally