Error de compilación con JOGL

I try to compile a simple Java program with JOGL OpenGL, from the command line. In the Eclipse all works fine, when I compile it from the command line with javac Obtuve el siguiente error:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLEventListener
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
...
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLEventListener
...
Could not find the main class: SimpleScene.  Program will exit.

I already add to -classpath todos the .jar files I find in JOGL directory. The Makefile to build the program is the following:

SimpleScene:
  javac -Xlint:deprecation -classpath  \
  $(jogl)/joal.jar:\
  $(jogl)/jogl.os.x11.jar:\
  ...
  $(jogl)/nativewindow.awt.jar:\
  $(jogl)/jogl_cg-natives-linux-i586.jar:. \
  SimpleScene.java

preguntado el 10 de marzo de 12 a las 13:03

¿Afecta la regulación de la jar tf <jogl-jar> | grep GLEventListener mostrar algo? -

./jogl.all.jar contiene javax/media/opengl/GLEventListener.class, and a few other JARs as well -

then add that jar to your classpath. javac -cp jogl-all.jar <your filename>.java -

As I wrote in the question, I already add all JOGL jars -

Then, can you post the exact arguments you're passing to javac? I believe you're missing the current path where jogl jars reside. If it's in the same directory as your main class, try javac -cp jogl-all.jar:. MainClass.java. Reemplazar : con ; si está en Windows. -

1 Respuestas

I had a similar problem and figured out my simple mistake. GLEventListenere is an interfaz.; not a class.

http://download.java.net/media/jogl/builds/archive/jsr-231-beta5/javadoc_public/javax/media/opengl/GLEventListener.html

I fixed my problem after realizing this because my code that uses GLEventListener should use the keyword 'implements' instead of 'extends'.

contestado el 15 de mayo de 12 a las 16:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.