Unit 6 - Processing libraries
Topics:
CLASSPATH
- using the Processing libraries
Bouncing ball demo files:
Set your CLASSPATH
On Mac, if you installed Processing in your Applications folder, the
Processing library (.jar) files are in /Applications/Processing.app/Contents/Java/core/library/*
Use the CLASSPATH
environment variable so that javac/java
can find the Processing .jar files.
export CLASSPATH=".:/Applications/Processing.app/Contents/Java/core/library/*"
You will want to add this line to your shell initialization file, e.g.
.bash_profile
, .bashrc
, or .zshrc
depending on your setup.
Hello Processing libraries!
import processing.core.*;
public class Hello extends PApplet
{
public void settings()
{
size(400, 400); // must be in settings(), not setup()
}
public void setup()
{
x = -50;
}
public void draw()
{
background(0);
ellipse(x, 200, 100, 50);
x += 5;
if (x > width + 50)
x = -50;
}
private float x;
public static void main(String[] args)
{
PApplet.main("Hello");
}
}