我从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。我想念什么? 最佳答案
关于java - 从命令行调用时,我缺少使用Processing opengl库的什么?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9760015/