views:

606

answers:

2

I'm trying to turn my JoGL project into a jar. Can someone tell me what I'm doing wrong? http://www.megaupload.com/?d=MA3LF50J

EDIT from schnaader: Stacktrace from my PC:

EDIT FROM WILLIAM: It runs on my PC just fine as a normal project inside JCreator, so I know it's not the code. I have JoGL in the /lib/ext/ folder of my jre too.

Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GL
EventListener
        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)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLEventListener
        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)
        ... 12 more
Could not find the main class: chartest.  Program will exit.

EDIT2 from schnaader: Contents of the JAR file:

META-INF\MANIFEST.MF
gluegen-rt.jar
jogl.jar
chartest$1.class
chartest.class
gluegen-rt.dll
jogl.dll
jogl_awt.dll
jogl_cg.dll
test.png
+4  A: 

You can check your classpath. It should include atleast

  • The jar file with classes you have written
  • Supporting jars with classes like javax.media.opengl (jogl.jar?)

Try placing all these jars in your classpath and run it.

talonx
A: 

is Jogle jar file in your classpath ?

I see you have included the jars themselves in your jar... this unfortunately wil not work out of the box.

Either get the jars out then place in your classpath (that can be part of your manifest also) or write your own classloader...

http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html

This is why it worked for William and not for you... he got the jogl from somewhere else and did not use the one within your jar.

Newtopian