JOGL2 test compiles, but doesn't execute - help?
- by Chuchinyi
I have a problem with JOGL2.
My JOGL2Template.java compiles fine, but executing it results in the following error:
D:\java\java\jogl>javac JOGL2Template.java <== compile ok
D:\java\java\jogl>java JOGL2Template <== execute error
Exception in thread "main" java.lang.ExceptionInInitializerError
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:1176)
at JOGL2Template.<init>(JOGL2Template.java:24)
at JOGL2Template.main(JOGL2Template.java:57)
Caused by: java.lang.SecurityException: no certificate for gluegen-rt.dll in D:\
java\lib\gluegen-rt-natives-windows-i586.jar
at com.jogamp.common.util.JarUtil.validateCertificate(JarUtil.java:350)
at com.jogamp.common.util.JarUtil.validateCertificates(JarUtil.java:324)
at com.jogamp.common.util.cache.TempJarCache.validateCertificates(TempJa
rCache.java:328)
at com.jogamp.common.util.cache.TempJarCache.bootstrapNativeLib(TempJarC
ache.java:283)
at com.jogamp.common.os.Platform$3.run(Platform.java:308)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.loadGlueGenRTImpl(Platform.java:298)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:207)
... 3 more
Here is the JOGL2Template.java source code:
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.FPSAnimator;
import javax.swing.JFrame;
/*
* JOGL 2.0 Program Template For AWT applications
*/
public class JOGL2Template extends JFrame implements GLEventListener {
private static final int CANVAS_WIDTH = 640; // Width of the drawable
private static final int CANVAS_HEIGHT = 480; // Height of the drawable
private static final int FPS = 60; // Animator's target frames per second
// Constructor to create profile, caps, drawable, animator, and initialize Frame
public JOGL2Template() {
// Get the default OpenGL profile that best reflect your running platform.
GLProfile glp = GLProfile.getDefault();
// Specifies a set of OpenGL capabilities, based on your profile.
GLCapabilities caps = new GLCapabilities(glp);
// Allocate a GLDrawable, based on your OpenGL capabilities.
GLCanvas canvas = new GLCanvas(caps);
canvas.setPreferredSize(new Dimension(CANVAS_WIDTH, CANVAS_HEIGHT));
canvas.addGLEventListener(this);
// Create a animator that drives canvas' display() at 60 fps.
final FPSAnimator animator = new FPSAnimator(canvas, FPS);
addWindowListener(new WindowAdapter() { // For the close button
@Override
public void windowClosing(WindowEvent e) {
// Use a dedicate thread to run the stop() to ensure that the
// animator stops before program exits.
new Thread() {
@Override
public void run() {
animator.stop();
System.exit(0);
}
}.start();
}
});
add(canvas);
pack();
setTitle("OpenGL 2 Test");
setVisible(true);
animator.start(); // Start the animator
}
public static void main(String[] args) {
new JOGL2Template();
}
@Override
public void init(GLAutoDrawable drawable) {
// Your OpenGL codes to perform one-time initialization tasks
// such as setting up of lights and display lists.
}
@Override
public void display(GLAutoDrawable drawable) {
// Your OpenGL graphic rendering codes for each refresh.
}
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
// Your OpenGL codes to set up the view port, projection mode and view volume.
}
@Override
public void dispose(GLAutoDrawable drawable) {
// Hardly used.
}
}
Any ideas what might be the cause of these errors?