I just Started Java BUT I'M FOR SURE I CAN GET A HANG OF THIS!

ive typed these pages out and Cant Find the Problem.. I NEVER START OUT EASY!! SO FAR EVERY TIME I START OUT EASY I LOSE WHERE I AM!!

so this is a rotating 2d picture.. but i cant get it to work it has errors.. but i cannot find the problem.. please help?

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:106)
    at javax.media.opengl.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:520)
    at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:131)
    at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:90)
    at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:83)
    at MainFrame.<init>(MainFrame.java:14)
    at OpenGLDemo.main(OpenGLDemo.java:8)
Caused by: java.lang.ClassNotFoundException: com.sun.gluegen.runtime.DynamicLookupHelper
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    ... 33 more

what i am trying to do is create a simple sprite.. i have not quite added the sprite skin but here is what i got

GLListener

import javax.swing.*;
import java.awt.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;

public class GLListener implements GLEventListener{

    @Override
    public void display(GLAutoDrawable d) {

        GL gl = d.getGL();

        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
        gl.glLoadIdentity();

        gl.glBegin(GL.GL_QUADS);

        gl.glTexCoord2d(0, 1);
        gl.glVertex3d(-1, 1, 0 );

        gl.glTexCoord2d(1, 1);
        gl.glVertex3d(1, 1, 0 );

        gl.glTexCoord2d(1, 0);
        gl.glVertex3d(1, -1, 0 );

        gl.glTexCoord2d(0, 0);
        gl.glVertex3d(-1, -1, 0 );

        gl.glEnd();



    }

    @Override
    public void displayChanged(GLAutoDrawable arg0, boolean arg1, boolean arg2) {
        // TODO Auto-generated method stub

    }

    @Override
    public void init(GLAutoDrawable d) {

        GL gl = d.getGL();
        GLU glu = new GLU();

        gl.glShadeModel(GL.GL_SMOOTH);
        gl.glDepthFunc(GL.GL_LESS);
        gl.glEnable(GL.GL_DEPTH_TEST);

        gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
        gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);

        gl.glMatrixMode(GL.GL_PROJECTION);
        gl.glLoadIdentity();
        glu.gluPerspective(40f, ((double) d.getWidth()) / d.getHeight(), 0.1f, 100f);
        gl.glMatrixMode(GL.GL_MODELVIEW);
        gl.glViewport(0, 0, d.getWidth(), d.getHeight());

    }

    @Override
    public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3,
            int arg4) {

    }

}

MainFrame

import javax.swing.*;
import java.awt.*;
import javax.media.opengl.*;


public class MainFrame extends JFrame{


    GLCanvas c;

    public MainFrame (){
        super();

        c =  new GLCanvas();
        c.addGLEventListener(new GLListener());
        this.add(c);

        this.setSize(640,480);
        this.setTitle("First Program");
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        centreWindow();

    }

    public void centreWindow(){
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = this.getSize();

    this.setLocation((screenSize.width - frameSize.width) >> 1, screenSize.height - frameSize.height >> 1 );


     }

}

OpenGLDemo

import javax.swing.*;


public class OpenGLDemo {

    public static void main(String[]Args) {

        final MainFrame frame = new MainFrame();

        SwingUtilities.invokeLater(new Thread(){
            public void run () {
                frame.setVisible(true);
            }
        });
    }

}

ive downloaded this

Java SE SDK Download
eclipse classic download
that opengl thing..

and i downloaded jogl. and inserted it into the project file

i cant find the prob.. :confused:

Edited 3 Years Ago by mike_2000_17: Fixed formatting

The problem is that it cannot find the class com.sun.gluegen.runtime.DynamicLookupHelper when initializing a GLCanvas. Did you include the gluegen-rt.jar library in your classpath?

The problem is that it cannot find the class com.sun.gluegen.runtime.DynamicLookupHelper when initializing a GLCanvas. Did you include the gluegen-rt.jar library in your classpath?

hmm... its in there..


ok.. nevermind.. its cause im using eclipse.. and i had to add the jar going through the menu bar

This article has been dead for over six months. Start a new discussion instead.