JOGL Problem: NoClassDefFoundError: net/java/games/jogl/GLEventListener

I am just trying to run a simple “hello world” type JOGL example. It (of course) runs fine in netbeans, but at the command line it is failing.

I am executing with: java -jar name.jar
I get back: Exception in thread “main” java.lang.NoClassDefFoundError: net/java/games/jogl/GLCapbilities

All the main includes is:
System.loadLibrary(“jogl”);
System.out.println(“Hello World! (The native libraries are there.)”);
GLCapabilities caps = new GLCapabilities();
System.out.println(“Hello JOGL! (The jar appears to be available.)”);

It will run in my IDE (netbeans) but not from the command-line. I have my CLASSPATH=".;C:\Program Files\Java\jdk1.5.0_06\jre\lib\ext\jogl.jar". Trying to set another copy at the command-line with “-cp …” changes nothing.

Any ideas?

Thanks in advance for your help!

The -jar command to java overrides all classpath settings. You need to add your jar to your classpath and then it should work. I would strongly advise against putting jogl.jar into jre/lib/ext as doing so will interfere with other applications which deploy JOGL via Java Web Start and other means.

Hmm, interesting. I will try that out.

Where would suggest I put jogl.jar?

Thanks!

Put it in a random directory and set your CLASSPATH environment variable to contain the full path to the jar file. The only disadvantage is you can’t use the -jar option to Java without setting a Class-Path entry in your Manifest.