Hi,
I'm trying to embed an opengl PApplet in a Frame but I'm getting this error:
---
D:\jorge\Java\saverbeans-sdk-0.2>java -classpath core.jar;opengl.jar;jogl.jar;.
Test
java.lang.NoSuchMethodError: processing.core.PGraphics3D: method <init>()V not f
ound
at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:103)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at processing.core.PApplet.createGraphics(PApplet.java:1113)
at processing.core.PApplet.size(PApplet.java:897)
at processing.core.PApplet.size(PApplet.java:838)
at DesafioTexturaDinamica.setup(DesafioTexturaDinamica.java:13)
at processing.core.PApplet.handleDisplay(PApplet.java:1285)
at processing.core.PGraphics.requestDisplay(PGraphics.java:680)
at processing.core.PApplet.run(PApplet.java:1454)
at java.lang.Thread.run(Unknown Source)
Error while running applet.
java.lang.RuntimeException: processing.core.PGraphics3D: method <init>()V not fo
und
at processing.core.PApplet.createGraphics(PApplet.java:1130)
at processing.core.PApplet.size(PApplet.java:897)
at processing.core.PApplet.size(PApplet.java:838)
at DesafioTexturaDinamica.setup(DesafioTexturaDinamica.java:13)
at processing.core.PApplet.handleDisplay(PApplet.java:1285)
at processing.core.PGraphics.requestDisplay(PGraphics.java:680)
at processing.core.PApplet.run(PApplet.java:1454)
at java.lang.Thread.run(Unknown Source)
java.lang.RuntimeException: processing.core.PGraphics3D: method <init>()V not fo
und
at processing.core.PApplet.createGraphics(PApplet.java:1130)
at processing.core.PApplet.size(PApplet.java:897)
at processing.core.PApplet.size(PApplet.java:838)
at DesafioTexturaDinamica.setup(DesafioTexturaDinamica.java:13)
at processing.core.PApplet.handleDisplay(PApplet.java:1285)
at processing.core.PGraphics.requestDisplay(PGraphics.java:680)
at processing.core.PApplet.run(PApplet.java:1454)
at java.lang.Thread.run(Unknown Source)
D:\jorge\Java\saverbeans-sdk-0.2>
---
My code is this:
Code:
import java.awt.Color;
import java.awt.Component;
import java.awt.*;
import java.awt.Graphics;
import java.awt.Point;
import java.util.Properties;
import java.util.logging.*;
import java.io.*;
import processing.core.*;
import processing.opengl.*;
import java.net.*;
public class Test extends Frame {
public Test() {
super("Embedded PApplet");
setLayout(new BorderLayout());
PApplet applet;
try {
URL u[] = {new URL("file", null, "DesafioTexturaDinamica.jar")};
URLClassLoader ucl = new URLClassLoader(u);
Class cl = ucl.loadClass("DesafioTexturaDinamica");
applet = (PApplet) cl.newInstance();
applet.init();
applet.size(320, 300);
add(applet, BorderLayout.CENTER);
} catch (ClassNotFoundException cnfe) {
System.out.println("Classnotfound" + cnfe.getMessage());
} catch (InstantiationException ie) {
System.out.println("InstantiationException" + ie.getMessage());
} catch (IllegalAccessException iae) {
System.out.println("IllegalAccessException"+iae.getMessage());
} catch (Exception e) {
System.out.println("Exception"+e.getMessage());
}
}
public static void main(String args[]) {
Test t = new Test();
t.setSize(new Dimension(800, 600));
t.show();
}
}
Does anybody know what I'm missing here?
thanks,
jorge