Installation woes!!

Firstly, I want to apologize, because I’m sure that you have received this type of request a bazillion times, but truly I did try to solve the problem myself and in the end it was insurmountable. For some reason I can’t get jogl installed on Mac OS 10.4.9. There was a point when I could compile the jogl-demos, but never could I run them and now I can’t do either.

Originally, I never had the CLASSPATH, or the DYLD_LIBRARY_PATH environment variables. I created them, but they only temporarily existed, so I added them to the .bash_login file. Now they are loaded whenever the terminal is loaded. I added the paths to the jogl.jar and the glugen.jar to the Classpath, and the lib folder to the DYLD path. Still no go.

The problem is, that I’ve never had to mess with this type of stuff. I’m accostomed to Eclipse, and have a firm grounding of java, yet no graphics. JOGL is my first attempt at something like that, but first I need to be able to install it. I can run the web jogl files though and view the demos that way. But I couldn’t run them ever, and now I can’t even compile anymore. Finally, when I did compile it, and when I ran it I would get an error about can’t find main manifest. But I didn’t understand that.

Any help would be very appreciated.

Here’s an example of what you probably need in your .bash_login:


export CLASSPATH=.:/Users/kirby9/jogl/jogl.jar:/Users/kirby9/jogl/gluegen-rt.jar
export DYLD_LIBRARY_PATH=/Users/kirby9/jogl

Assuming jogl.jar, gluegen-rt.jar, and all of the dylibs are in /Users/kirby9/jogl/ .

At that point you should be able to compile a self-contained .java file referencing the JOGL classes with just javac on the command line, and run the resulting class file.

If you try this and it doesn’t work, please post the relevant contents of your .bash_login as well as the output of “ls” of all of the directories referenced in your setting of the CLASSPATH and DYLD_LIBRARY_PATH variables.

So, things get a little more confusing. I have all of my files (jogl.jar, gluegen.jar, and the jnilib files all in one directory:

/Applications/Programming\ Additions/JOGL/lib

maybe the problem is the \ in the file directory path, but this is the way it comes up in the terminal, so figured that’s how I should use it in the login file.

And I found out that I can build, using the build.xml and ant, the Nehe tutorials, but I can’t run the corresponding jars. I receive the error:
“Exception in thread “main” java.lang.NoClassDefFoundError: javax/media/opengl/GLEventListener”

which seems that even though I can compile, sometimes, the jar file can’t find the appropriate classes.

Here is my .bash_login file, the last line is just a variable for mySQL

export CLASSPATH="$CLASSPATH:.:/Applications/Programming\ Additions/JOGL/lib/jogl.jar:/Applications/Programming\ Additions/JOGL/lib/gluegen-rt.jar:/Applications/Programming\ Additions/JOGL/lib"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/Applications/Programming\ Additions/JOGL/lib"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

In conclusion: I still can’t compile the jogl-demos, but strangley can compile the Nehe ones, but still can’t run them.

Thanks guys for the help

Quick thought, maybe I should copy the jogl.jar and gluegen.jar and the native library files into another standard Java extensions folder. Some sites I read suggest this whiles others warn against it. Also, maybe the problem has something to do with eclipse, because that used to take care of all the classpaths, but even then I could run stuff through the terminal.

I forgot to attach the things files actually in the directory that the CLASSPATH AND DYLD_LIBRARY_PATH link to.

gluegen-rt.jar libgluegen-rt.jnilib libjogl_awt.jnilib
jogl.jar libjogl.jnilib libjogl_cg.jnilib

just the six files from the jogl.zip that I downloaded. Also, I found out that my env variables are including a : at the end of the path, completely invalidating the path.

any ideas? Maybe I should get rid of the space in between the Programming Additions?

UPDATE:

I changed the folder by removing the space. I made the .bash_login work, by removing some things.

export CLASSPATH=".:/Applications/ProgrammingAdditions/JOGL/lib/jogl.jar:/Applications/ProgrammingAdditions/JOGL/lib/gluegen-rt.jar:/Applications/ProgrammingAdditions/JOGL/lib"
export DYLD_LIBRARY_PATH="/Applications/ProgrammingAdditions/JOGL/lib"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

Now I can compile again, but I can’t run anything. The jar files say:

Failed to load Main-Class manifest attribute from

We’re one of the sites that warn against it :slight_smile:

Anyway, the error ‘Failed to load Main-Class manifest…’ usually means that you’ve tried to execute a JAR file (eg: java -jar nameofjar.jar), and that JAR file’s /meta-inf/Manifest.mf file doesn’t have a line that looks like this:

Main-Class: com.mysite.NameOfClassToRun

If that JAR file is something you’ve made, you can fix that by recreating the JAR with a Main-Class attribute in the manifest file. Or, don’t use the -jar switch, and instead just add the JAR to the classpath and specify which class is the main class to run:

java -cp nameofjarfile.jar com.mysite.NameOfClassToRun

Ok, so I’m trying to run the jogl-demos, the ones that come from the main site. Using your command I got past the “manifest” problem and now I have this problem:

java -classpath jogl-demos.jar demos.gears.Gears
Exception in thread “main” java.lang.NoClassDefFoundError: javax/media/opengl/GLEventListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

So now it can’t find the jogl informations???

no idea, but thanks so far. It seems like we’re getting somewhere.

Can’t find GLEventListener. That’s something that’s in the jogl.jar file.

OK, I dunno what the command is in Mac, but now that we’ve overridden the CLASSPATH environment variable with your own using -classpath, you gotta include CLASSPATH in it again. On windows, that’d be like:

java -cp jogl-demos.jar;%CLASSPATH% demos.gears.Gears

Mac I think it’s:

java -cp jogl-demos.jat;$CLASSPATH demos.gears.Gears

You know what I’m on about.

So, techinically, I never overwrote the CLASSPATH variable. It never existed before, or at least never existed in the terminal. I added it to the .bash_login such that every time I open the terminal it loads the command.

I tried using a a variation of commands to get this working, but to no avail:

java -cp jogl-demos.jar $CLASSPATH demos.gears.Gears Exception in thread “main” java.lang.NoClassDefFound
java -cp jogl-demos.jar /Applications/ProgrammingAdditions/JOGL/lib/jogl.jar
java -cp jogl-demos.jar /Applications/ProgrammingAdditions/JOGL/lib/
and many other versions all of which give the same error.

The only difference is this one
java -jar -cp demos.gears.Gears /Applications/ProgrammingAdditions/JOGL/lib/jogl.jar

I added the -jar and I receive this error:
Failed to load Main-Class manifest attribute from
/Applications/ProgrammingAdditions/JOGL/lib/jogl.jar

Why is everything in life so hard?

Very strange, I found a way that I can run some of the jogl-demos, not all but a number of the basic ones

So I built the files using ant, it created all the folders and put them in a folder called Classes.
I can go into this Classes folder and type things like
java demos/j2d/TextCube

and magically it works, no need for class path stuff or anything, just works based on the hierarchy or something. Any ideas.

Maybe my ant compilation thing is all weird???

Err, I think you gotta separate the entries in your classpath with a ; (semi-colon).

Anyway, as to why everything in life is so difficult:

  • When running a JAR file using -jar, Java uses the classpath specified in the JAR’s manifest file (look for the Class-Path entry), and ignores any classpath you supply via -cp, -classpath, or in the CLASSPATH environment variable. I don’t know if Java falls-back to those 3 if the Class-Path entry is missing.
  • When running a class file, Java will use the classpath specified by -cp or -classpath first, before falling-back to the CLASSPATH environment variable. This is why it’s good to include %CLASSPATH% (or $CLASSPATH, or however it is on your platform)

I dunno if Eclipse does it, but some IDEs (silently) include the CLASSPATH environment variable when possible, to lessen the user’s headache.

Yah, the separation is : just a colon. But my question is, how come I can open up some of these demo classes, but not all of them and is there anyway I can make such that I can simply open up the jar files to run the demos as they were intended to be used.

I fear that if I ignore this problem it will be ever persistent in my jogl career.

Not sure if it’s supposed to be that easy. The jogl-demos is really a collection of demos, so unless the JAR comes with some sort of launcher program to select and execute a demo for you, it’s gonna be command-line driven.

Maybe you could extract the demos, put them into a project in an IDE like Eclipse or NetBeans, setup the build path properly so it gets the library path right and uses the JARs from JOGL and Gluegen, and then just right-click-run each demo.

A jar file DOES come with the jogl-demos, but sadly I can’t use it yet. I’ve tried all sorts of classpath combinations, attempts, failures, the works.

I’m completely stuck, and frustrated with my jogl experience.

Am I the only one having so much trouble?

Anyone want to be my friend/genius and help me out?

I don’t mind helping, but that means you’ve got to start by detailing your setup. That means all the details about which version of Java you got installed (don’t guess, but run “java -version”), where did you install which JOGL files, where did you save the demos, show a list of all those files so we can be sure all files are accounted for. A dump of any environment variables. Anything that you think might help and then some.

Ok, lets do this!

java version “1.5.0_07”
Java™ 2 Runtime Environment, Standard Edition (build 1.5.0_07-164)
Java HotSpot™ Client VM (build 1.5.0_07-87, mixed mode, sharing)

Where are all the files?

jogl files:
/Applications/ProgrammingAdditions/JOGL/lib
gluegen-rt.jar libgluegen-rt.jnilib libjogl_awt.jnilib
jogl.jar libjogl.jnilib libjogl_cg.jnilib

Env variables that load when I open a new terminal. I added these to the .bash_login file, because originally I didn’t have a CLASSPATH or a DYLD_LIBRARY_PATH

export CLASSPATH=".:/Applications/ProgrammingAdditions/JOGL/lib:/Applications/ProgrammingAdditions/JOGL/lib/jogl.jar:/Applications/ProgrammingAdditions/JOGL/lib/gluegen-rt.jar:$CLASSPATH"
export DYLD_LIBRARY_PATH="/Applications/ProgrammingAdditions/JOGL/lib:$DYLD_LIBRARY_PATH"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

I’ve tried multiple versions of these env variables, ones that diidn’t include a repeat of the variable at the end. But nothing seems to work.

Where are my jogl-demos?:

~/Desktop/jogl-demos
this is the unzipped directory, that comes about from the original zipped src file.

Here are its content folders, and after running ant in the make folder, a build folder was created and the jar files and classes.:
build doc lib make src

In build:

classes jogl-demos-src.zip jogl-demos.jar
jogl-demos-data.jar jogl-demos-util.jar

in classes:
demos gleem

in demos:
applets j2d testContextDestruction
common jgears testContextSharing
context jrefract texture
fullscreen misc util
gamma multisample vertexArrayRange
gears particles vertexBufferObject
hdr printext vertexProgRefract
hwShadowmapsSimple proceduralTexturePhysics vertexProgWarp
infiniteShadowVolumes tess xtrans

So everything is there the compile worked correctly. I can show you the ant out put if you prefer.

Buildfile: build.xml

test.for.jogl.demos.jar:

java.class.path.validate:

setup.cg.excludes:

skip.cg.excludes:

init:

all:
[delete] Deleting: /Users/Eric/Desktop/jogl-demos/build/jogl-demos-src.zip
[zip] Building zip: /Users/Eric/Desktop/jogl-demos/build/jogl-demos-src.zip

BUILD SUCCESSFUL
Total time: 9 seconds

Now, I can run some of these classes, first i have to go to the folder classes in the build directory and type for example:
java demos/j2d/FlyingText

this sometimes works, and other times doesn’t. For example I can’t get the particle engine to work. I can load the ControlWindow class in the engine files, but there
are errors and only the swing components are shown. Here is the error output.

Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at com.sun.opengl.util.texture.TextureIO.newTexture(TextureIO.java:523)
at demos.particles.engine.Engine.init(Engine.java:85)
at demos.particles.engine.GLComponent.init(GLComponent.java:105)
at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)
at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:271)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:265)
at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)
at sun.awt.RepaintArea.paintComponent(RepaintArea.java:276)
at sun.awt.RepaintArea.paint(RepaintArea.java:241)
at apple.awt.ComponentModel.handleEvent(ComponentModel.java:251)
at java.awt.Component.dispatchEventImpl(Component.java:4097)
at java.awt.Component.dispatchEvent(Component.java:3869)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Exception in thread “Timer-0” javax.media.opengl.GLException: java.lang.NullPointerException
at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:263)
at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
at com.sun.opengl.util.Animator.display(Animator.java:144)
at com.sun.opengl.util.FPSAnimator$1.run(FPSAnimator.java:95)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: java.lang.NullPointerException
at demos.particles.engine.Particle.draw(Particle.java:61)
at demos.particles.engine.Engine.draw(Engine.java:77)
at demos.particles.engine.GLComponent.display(GLComponent.java:74)
at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78)
at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:288)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:194)
at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:305)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Also, there has never been a time when I could run the jogl-demos.jar files that were created in the build directory. I’ve tried running them using all types of -cp combinations and all types guesswork. Nothing. I usually receive this no matter what my CLASSPATH is.

Failed to load Main-Class manifest attribute from
jogl-demos.jar

Ok this is a lot of information and hopefully it can help. If you guys need more, yah, I can find more.

eric

Anyone see any obvious errors?

Any ideas?

Well at least it’s not can’t find GLEventListener problems like before, so this at least means the app is finding all of the class files just fine. I noticed the error is a null at TextureIO.newTexture(). I suspect this means it can’t find the image file to use for a texture? Can you step through the program and confirm this?

You were absolutely right, and I feel like an idiot. It seems that when I built the files from ant, it produced the class files, but didn’t also copy over the images. When I did this, everything worked. Or at least the particle class worked.

Now I’ll just assume that the jogl-demos.jar file doesn’t work for some similar reason, something beyond my powers.

Thank you so much for helping out. I really appreciate it