从命令行调用时,我缺少什么来使用Processing opengl库?

时间:2012-03-18 16:30:51

标签: java processing

我从here获得了草图:

import processing.opengl.*;

float a; 

void setup() {
  size(800, 600, OPENGL);
  fill(0, 153);
  noStroke();
}

void draw() {
  background(255);
  translate(width/2, height/2);
  rotateX(a);
  rotateY(a*2);
  rect(-200, -200, 400, 400);
  rotateX(PI/2);
  rect(-200, -200, 400, 400);
  a += 0.01;
}

当我从Processing IDE运行此草图时,它可以正常工作。试图从命令行运行它,不那么:

$ /home/blt/projects/processing-1.2.1/java/bin/java -classpath "/home/blt/projects/processing-1.2.1/java/lib/rt.jar:/home/blt/projects/processing-1.2.1/java/lib/tools.jar:/home/blt/projects/processing-1.2.1/lib/antlr.jar:/home/blt/projects/processing-1.2.1/lib/core.jar:/home/blt/projects/processing-1.2.1/lib/ecj.jar:/home/blt/projects/processing-1.2.1/lib/jna.jar:/home/blt/projects/processing-1.2.1/lib/pde.jar:/home/blt/projects/processing-1.2.1/libraries/opengl/library/opengl.jar:/home/blt/projects/processing-1.2.1/libraries/opengl/library/jogl.jar:/home/blt/projects/processing-1.2.1/libraries/opengl/library/gluegen-rt.jar" processing.app.Commander --sketch="/home/blt/sketchbook/sketch_mar18a/" --output="/home/blt/sketchbook/sketch_mar18a/output" --run
Exception in thread "main" java.lang.NullPointerException
    at processing.app.Sketch.preprocess(Sketch.java:1381)
    at processing.app.Sketch.preprocess(Sketch.java:1205)
    at processing.app.Sketch.build(Sketch.java:1568)
    at processing.app.Commander.<init>(Commander.java:206)
    at processing.app.Commander.main(Commander.java:97)

请注意,在类路径的末尾,我已经包含了libraries/opengl/library/export.txt中提到的所有jar。我错过了什么?

1 个答案:

答案 0 :(得分:1)