whats wrong with this Jar file?

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-INFMANIFEST.MF
gluegen-rt.jar
jogl.jar
chartest$1.class
chartest.class
gluegen-rt.dll
jogl.dll
jogl_awt.dll
jogl_cg.dll
test.png

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.


    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.


    Switch to Netbeans to build your jar file. I find using other libraries inside of my projects including dll files its best to use something like Netbeans or just package it with maven.

    mvn clean package
    

    You need to be well versed in xml though if you want to use maven to package all of your jar files.

    链接地址: http://www.djcxy.com/p/20262.html

    上一篇: Java Picasa API目录列表不起作用

    下一篇: 这个Jar文件有什么问题?