简体   繁体   中英

Compile error with 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 I get the following 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 all 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

I had a similar problem and figured out my simple mistake. GLEventListenere is an interface ; 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'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM