nehe java ports - lesson01 compiling error

hi.

i have just installed the java ports for nehe opengl tutorial.

i am starting on lesson01 - i have implemented the files into my build environment and project…

i have successfully compiled Lesson01.java

problem: Following is the error i receive when i type “java Lesson01” into the command prompt
Exception in thread “main” java.lang.NoClassDefFoundError: Lesson01(wrong name: demos/nehe/lesson01/Lesson01)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass1(Native Method)

error continued:
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.SecureClassLoader.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.net.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.net.ClassLoader.loadClass(Unknown Source)
at java.net.ClassLoader.loadClassInternal(Unknown Source)

help? i dont understand what this means

put it in the right package

what do you mean?
this is my current directory structure:
JAVA:
FOLDER: demos
–> common
------> bunch of classes
–> nehe
------> lesson01
----------> Lesson01.java, Renderer.java
FILE: Lesson01.java, Renderer.java

I am compiling the ones in the root JAVA directory. Is that wrong?

i just tried compiling the demos/nehe/lesson01/Lesson01.java

compiling worked

but i received the same error when i tried to run it

in case it helps, following is the code for Lesson01.java:

package demos.nehe.lesson01;
import demos.common.GLDisplay;

/**
 * @author Kevin J. Duling
 */
public class Lesson01 {
    public static void main(String[] args) {
        GLDisplay neheGLDisplay = GLDisplay.createGLDisplay("Lesson 01: An OpenGL Window");
        neheGLDisplay.addGLEventListener(new Renderer());
        neheGLDisplay.start();
    }
}

You need the right directory structure. When compiling, do “javac -d . Lesson01.java”. The “-d .” is significant and tells javac to create subdirectories corresponding to the full directory tree. When running, “java demos.nehe.lesson01.Lesson01”.

ok here is what i did:

–> javac -d . Lesson01.java
no errors
–> java demos.nehe.lesson01.Lesson01
the frame opens and there are a bunch of errors in it (there are no errros in the command prompt)
mainly:

Exception Occured
javax.media.opengl.GLException:java.lang.reflect.InvocationTargetException
at…javax.media.opengl.GLCanvas…
at…java.awt…
at…java.swing
at…demos.common.GLDisplay.start…
at…demos.nehe.lesson01.Lesson01.main(Lesson01.java:12)
caused by java.lang.reflect.InvocationTargetException
at…
at…
at…

and it goes on and on
i am really lost as to what is happening. i have never encountered this before i downnloaded jogl

how do i fix it?

We need the full stack trace in order to diagnose the problem. Put it in a “code” block.

Actually I suspect you’ve run into the same problem as in this thread. Take a look and if so please try the workarounds listed there.

well tahts bad news…

i used jdk update 10!!

so what are the next steps?

delete all my files and reinstall java 5 jdk update 9??

You just need to uninstall JDK 5 update 10 and install update 9. You don’t need to delete any other files, and assuming you didn’t install JOGL into the JDK (which according to the user guide you shouldn’t have) then you shouldn’t need to do anything else.