Login  Register

Re: Help installing JOGL

Posted by Xerxes Rånby on Jan 30, 2013; 9:55am
URL: https://forum.jogamp.org/Help-installing-JOGL-tp3295611p4028057.html

Penny wrote
My command line command is...
"C:\Program Files\Java\jdk1.7.0_11\bin\javaw.exe" -cp ".;C:\Program Files\Java\jogl\jar\gluegen-rt.jar;C:\Program Files\Java\jogl\jar\jogl-all.jar" -jar MyProgram.jar

It compiles ok, but I am still at a guess as to how to have the jars included during runtime. "java.lang.NoClassDefFoundError: javax/media/opengl/GLProfile"
It is not possible to combine the CLASSPATH -classpath/-cp option with -jar the command line option.

Jar deployment
When you specify -jar expects all jars to be located according to the manifest file inside the main jar.
The -jar switch indicate that only the MyProgram.jar -> META-INF/MANIFEST.MF -> Class-Path: entry will be in use.
You need to add the gluegen-rt.jar and jogl-all.jar to the Class-Path: entry then -jar will work.
Usually java IDE such as Netbeans and Eclipse generate a correct MANIFEST.MF when you build or export your application.

With a correct MANIFEST.MF allows you to start your application using:
java -jar MyProgram.jar

External documentation for Jar deployment
http://en.wikipedia.org/wiki/Classpath_%28Java%29#Setting_the_path_in_a_Manifest_file
http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html

I can give you an example what a correct MANIFEST.MF can look like:
Directory structure:
pax.jar
pax_lib -> contains all JogAmp jars gluegen-rt.jar jogl-all.jar joal.jar and all the native jars.
pax.jar -> META-INF/MANIFEST.MF
Manifest-Version: 1.0
Class-Path: . pax_lib/gdx-natives.jar pax_lib/javaparser-1.0.8.jar pax_lib/gluegen-rt.jar pax_lib/jorbis.jar pax_lib/jogl-all.jar pax_lib/joal.jar pax_lib/jlayer-1.0.1-libgdx.jar
Main-Class: de.swagner.paxbritannica.PaxBritannicaDesktop

Note that the Class-Path: entry always uses / to separate directory’s and blanks to separate jars.

Classpath deployment using CLASSPATH -cp or -classpath option
You can always run your application by specifying all jars including your MyProgram.jar using -classpath and then specify your MainClass.
java -classpath "MyProgram.jar;gluegen-rt.jar;jogl-all.jar;." MainClass

The command line is different for windows and linux deployment,
windows uses ; to separate jars while linux uses :
windows uses \ to specify directory separator while linux uses /