IntelliJIdea JOGL export jar not working

Hi, I’ve managed to make a triangle show up with JOGL, but when I try to build artifact and run the jar that is made, nothing happens when I double click on it.

I am using jogl-2.0-pre-20101001-windows-i586

This is the output when I open it with the console:

C:\Java projects\IntelliJIdea\Project3\out\artifacts\unnamed>java -jar unnamed.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GL
EventListener
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        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)
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)
        ... 12 more
Could not find the main class: CMain. Program will exit.

Can someone help me fix this?
thanks,
roland

Hi

The JOGL JAR must be in your classpath. You should rather do something like this:

java -classpath jogl.jar:gluegen-rt.jar:unnamed.jar -Djava.library.path=where_the_DLL_are YOURMAINCLASS

Thanks for the help. Now when i run it with the console it doesnt say it can’t find the JOGL libraries but it says

C:\Java projects\JOGL LIB\jogl-2.0-pre-20101001-windows-i586\lib>java -jar
 unnamed.jar
Exception in thread "main" java.lang.NoClassDefFoundError: CMain
Caused by: java.lang.ClassNotFoundException: CMain
        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)
Could not find the main class: CMain. Program will exit.

In the classpath edit box i put “jogl.all.jar:gluegen-rt.jar:nativewindow.all.jar:unnamed.jar”
in the main class edit box i put “CMain”

when I pressed run in the IDE this is what came up in the console before displaying the triangle

"C:\Program Files\Java\jdk1.6.0_21\bin\java" -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files\IntelliJ IDEA Community Edition 9.0.3\bin" -Dfile.encoding=windows-1252 -classpath "C:\Program Files\Java\jdk1.6.0_21\jre\lib\alt-rt.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.6.0_21\jre\lib\ext\sunpkcs11.jar;C:\Java projects\IntelliJIdea\Project3\out\production\Project3;C:\Java projects\JOGL LIB\jogl-2.0-pre-20101001-windows-i586\lib\gluegen-rt.jar;C:\Java projects\JOGL LIB\jogl-2.0-pre-20101001-windows-i586\lib\jogl.all.jar;C:\Java projects\JOGL LIB\jogl-2.0-pre-20101001-windows-i586\lib\nativewindow.all.jar;C:\Program Files\IntelliJ IDEA Community Edition 9.0.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain CMain

Can you please tell me what I should do next to fix this?
sorry I don’t understand why this is happening.

Do it is command-line and sorry, change the file separator as you’re on Windows and I’m on Linux. Replace the “:” by “;”. Don’t use an IDE if you don’t understand how Java works. An IDE saves a lot of time if you really know what happens underneath.