NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

apoy2k
This post was updated on .
Hi there,

I'm trying to get Java3D to run on my Mac OS X Snow Leopard and Java 1.6

I have implemented the latest Java 3D and JOGL/Gluegen libaries exactly as specified in the respective wikis and tutorials. But, as soon as I run my project, I get an exception telling me that the javax/media/opengl/GLCapabilitiesChooser class could not be found.

All jars are in the classpath:

-classpath "/.../:
    /.../lib/gdv-api-1.2.jar:
    /.../lib/j3dcore.jar:
    /.../lib/j3dutils.jar:
    /.../lib/vecmath.jar:
    /.../lib/gluegen-rt.jar:
    /.../lib/jogl-all-natives-macosx-universal.jar:
    /.../lib/gluegen-rt-natives-macosx-universal.jar:
    /.../lib/jogl.all.jar:
    /Applications/IntelliJ IDEA 11 CE.app/lib/idea_rt.jar"

What's going wrong here?

Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesChooser
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at javax.media.j3d.Pipeline$1.run(Pipeline.java:143)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:138)
	at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:926)
	at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:280)
	at javax.media.j3d.NodeRetained.dirtyBoundsCache(NodeRetained.java:959)
	at javax.media.j3d.Shape3DRetained.setGeometry(Shape3DRetained.java:353)
	at javax.media.j3d.Shape3D.<init>(Shape3D.java:174)
	at kern.Flaeche3D.segmentierteFlaeche(Flaeche3D.java:203)
	at Szene3D.main(Szene3D.java:58)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLCapabilitiesChooser
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	... 17 more
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

Sven Gothel
Administrator
On 05/23/2012 12:09 PM, ApoY2k [via jogamp] wrote:

> Hi there,
>
> I'm trying to get Java3D to run on my Mac OS X Snow Leopard and Java 1.6
>
> I have implemented the latest Java 3D and JOGL/Gluegen libaries exactly as
> specified in the respective wikis and tutorials. But, as soon as I run my
> project, I get an exception telling me that the
> javax/media/opengl/GLCapabilitiesChooser class could not be found.
>
> All jars are in the classpath:
>
> -classpath
> "/.../:/Users/.../lib/gdv-api-1.2.jar:/.../lib/j3dcore.jar:/.../lib/j3dutils.jar:/.../lib/vecmath.jar:/.../lib/gluegen-rt.jar:/.../lib/jogl-all-natives-macosx-universal.jar:/.../lib/gluegen-rt-natives-macosx-universal.jar:/.../lib/jogl.all.jar:/Applications/IntelliJ
> IDEA 11 CE.app/lib/idea_rt.jar"
>
> What's going wrong here?

don't really know ..

maybe your classpath somehow contains another jogl version,
somehow cached or within your env. variable CLASSPATH ?

I also don't know your '/.../' notation, I assume it's an abbreviation here ?

You also add something like '/.../' which may add all class files located at
'/.../' (which location is unknown to me - see above).
Maybe you have some JOGL classes laying around there ?

Last but not least, maybe the other JAR files 'illegally'
contain some JOGL classes ?

+++

Pls drop the '*natives*' JAR in the classpath as well,
they are being picked up automatically.

+++

~Sven

Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

apoy2k
Sven Gothel wrote
don't really know ..

maybe your classpath somehow contains another jogl version,
somehow cached or within your env. variable CLASSPATH ?

I also don't know your '/.../' notation, I assume it's an abbreviation here ?
Yes. Here is the complete command that my IDE uses to start the project (Szene3D is my main project):

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
    -Didea.launcher.port=7536 
    "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 11 CE.app/bin"
    -Dfile.encoding=UTF-8
    -classpath
        "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar:
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:        
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:        
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar:        
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:        
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar:        
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar:        
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar:        
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar:        
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar:        
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar:        
        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar:        
        /Users/apoy2k/Development/ComputerGrafik/out/production/ComputerGrafik:        
        /Users/apoy2k/Development/ComputerGrafik/lib/gdv-api-1.2.jar:        
        /Users/apoy2k/Development/ComputerGrafik/lib/j3dcore.jar:        
        /Users/apoy2k/Development/ComputerGrafik/lib/j3dutils.jar:        
        /Users/apoy2k/Development/ComputerGrafik/lib/vecmath.jar:
        /Users/apoy2k/Development/ComputerGrafik/lib/gluegen-rt.jar:
        /Users/apoy2k/Development/ComputerGrafik/lib/jogl-all-natives-macosx-universal.jar:        
        /Users/apoy2k/Development/ComputerGrafik/lib/gluegen-rt-natives-macosx-universal.jar:        
        /Users/apoy2k/Development/ComputerGrafik/lib/jogl.all.jar:
        /Applications/IntelliJ IDEA 11 CE.app/lib/idea_rt.jar"
    com.intellij.rt.execution.application.AppMain Szene3D

Sven Gothel wrote
You also add something like '/.../' which may add all class files located at
'/.../' (which location is unknown to me - see above).
Maybe you have some JOGL classes laying around there ?

Last but not least, maybe the other JAR files 'illegally'
contain some JOGL classes ?
No, I never have installed any JOGL libraries. All libraries I have of those are in the lib/ folder

Sven Gothel wrote
Pls drop the '*natives*' JAR in the classpath as well,
they are being picked up automatically.
They are in the classpath already, aren't they? The last two entries are the natives.
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

Sven Gothel
Administrator
On 05/23/2012 02:47 PM, apoy2k [via jogamp] wrote:

>     Sven Gothel wrote
>     don't really know ..
>
>     maybe your classpath somehow contains another jogl version,
>     somehow cached or within your env. variable CLASSPATH ?
>
>     I also don't know your '/.../' notation, I assume it's an abbreviation here ?
>
> Yes. Here is the complete command that my IDE uses to start the project
> (Szene3D is my main project):
>

<snip/>

Seems the only 'open' folder, which could contain 'loose class files' is
  /Users/apoy2k/Development/ComputerGrafik/out/production/ComputerGrafik

But since you say the following below, it contains no JOGL classes:

>
>     Sven Gothel wrote
>     You also add something like '/.../' which may add all class files located at
>     '/.../' (which location is unknown to me - see above).
>     Maybe you have some JOGL classes laying around there ?
>
>     Last but not least, maybe the other JAR files 'illegally'
>     contain some JOGL classes ?
>
> No, I never have installed any JOGL libraries. All libraries I have of those
> are in the lib/ folder
>
>     Sven Gothel wrote
>     Pls drop the '*natives*' JAR in the classpath as well,
>     they are being picked up automatically.
>
> They are in the classpath already, aren't they? The last two entries are the
> natives.

I meant to *drop* them, i.e. do not add the *natives* JAR files to the
classpath. Sorry for the confusing wording.
Native JAR files are being derived and automatically located by JogAmp's
GlueGen native library loader.
However, I doubt that this is the problem here.

Can I reproduce this situation ?
Can you create a recipe what do download so I am able to
invoke the commandline ?

~Sven


Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

apoy2k
This post was updated on .
I can reproduce it. When I create a new Shape3D without any arguments, everything works fine. But as soon as I pass the first argument (TriangleArray), the error pops up.

So, a minimum (not) working example would be

import javax.media.j3d.*;

public class Tester {

    public static void main(String[] args) throws ClassNotFoundException {
        TriangleArray triangleArray = new TriangleArray(6, 7);
        new Shape3D(triangleArray);
    }

}
$ javac Tester.java
$ java Tester
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesChooser
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at javax.media.j3d.Pipeline$1.run(Pipeline.java:143)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:138)
	at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:926)
	at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:280)
	at javax.media.j3d.NodeRetained.dirtyBoundsCache(NodeRetained.java:959)
	at javax.media.j3d.Shape3DRetained.setGeometry(Shape3DRetained.java:353)
	at javax.media.j3d.Shape3D.<init>(Shape3D.java:157)
	at Tester.main(Tester.java:7)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLCapabilitiesChooser
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	... 11 more

I think it's an issue of the ClassLoader, because if I write

System.out.println(GLCapabilitiesChooser.class);

In the main method, my console writes without any errors interface javax.media.opengl.GLCapabilitiesChooser. So, the class is actually found without problems, but the URLClassLoader doesn't find it.
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

gouessej
Administrator
Are you sure no JOGL JAR has even been put directly into the VM?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

apoy2k
No, I definitely only have one installation of JOGL on my system. I searched the whole drive for it and the only location is /System/Library/Java/Extensions/

I also downloaded a new version of the J3D api and now I get a different error:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/AbstractGraphicsDevice

That class does actually exists, but in the package javax.media.opengl.nativewindow (jogl.all.jar)
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

Sven Gothel
Administrator
On 05/29/2012 11:43 AM, apoy2k [via jogamp] wrote:
> No, I definitely only have one installation of JOGL on my system. I searched
> the whole drive for it and the only location is */System/Library/Java/Extensions/*

You shall not install any JogAmp JAR files in the Java extension folder!
The latter is very deprecated and allows one to have conflicts
with different versions of JAR files, i.e. the one in the Extension folder
and the ones added in the CLASSPATH (IDE, ..).

>
> I also downloaded a new version of the J3D api and now I get a different error:
>
> *Exception in thread "main" java.lang.NoClassDefFoundError:
> javax/media/opengl/AbstractGraphicsDevice*
>

~Sven


signature.asc (910 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

apoy2k
Well, if I move the JOGL libraries out of the Extension directory, I get the exception with GLCapabilities again. If they are present, the exceptions ocurrs with javax.media.opengl.AbstractGraphicsDevice.
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

Sven Gothel
Administrator
On 05/30/2012 02:07 PM, apoy2k [via jogamp] wrote:
> Well, if I move the JOGL libraries out of the Extension directory, I get the
> exception with GLCapabilities again. If they are present, the exceptions
> ocurrs with javax.media.opengl.AbstractGraphicsDevice.
>

I asked earlier for a precise recipe to reproduce your earlier posted
commandline w/ your classpath.
This shall include all URLs to download the referenced JAR files.
Pls also include your test application (jar file if possible).

Then we are able to give it a try to reproduce the issue.

~Sven


signature.asc (910 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

apoy2k
I packaged it all in a JAR. I also downloaded J3D and JOGL again and used them. When I run the command

java -jar ComputerGrafik.jar

the already posted exception shows up:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/AbstractGraphicsDevice
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at javax.media.j3d.Pipeline$1.run(Pipeline.java:162)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:157)
	at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:965)
	at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:299)
	at javax.media.j3d.NodeRetained.dirtyBoundsCache(NodeRetained.java:978)
	at javax.media.j3d.Shape3DRetained.setGeometry(Shape3DRetained.java:372)
	at javax.media.j3d.Shape3D.<init>(Shape3D.java:176)
	at Tester.main(Tester.java:7)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.AbstractGraphicsDevice
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	... 11 more

PS: The file was too large to upload here, so get it here: http://ul.to/8s9rn09z (MD5: 30e90ff01616d6f3d0dd32b56f37017c)
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

hharrison
Which version of Java3d are you using, the prebuilt jars I released or Java3d1.5.2?  This error looks like what you'd
get trying to run the old jogl1-based backend with JOGL2 jars.  Either that, or you need at least JOGL2-rc8 to use
my prebuilt jars as some classes moved around i9n jogl2 between -rc5 and -rc8

Harvey
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

apoy2k
As I said, I downloaded the newest versions of both Java3D and JOGL before building the JAR file in my previous post:

http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-java-client-419417.html#java3d-1.5.1-oth-JPR

and

http://jogamp.org/deployment/jogamp-current/archive/
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

hharrison
That's your problem then, the 'latest' java3d you downloaded _does not support JOGL2_

I've released some jar files from a forked version of Java3d that removes all the native backends
and ports the jogl backend to support JOGL2...you can find them here:

https://github.com/hharrison/java3d-core
https://github.com/hharrison/java3d-utils
https://github.com/hharrison/vecmath

Under Downloads in each repo there is a prebuilt jar file....good luck!

Harvey
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

apoy2k
Oh dear, yes yes yes it works! You are my saviour! A thousand times thanks! I this were stackoverflow, I'd vote up the crap out of you!

Is there any page where this information is visible and I just overlooked it? This information is diamonds!
Reply | Threaded
Open this post in threaded view
|

Re: NoClassDefFoundError: GLCapabilitiesChooser on OS X Snow Leopard and Java 1.6

Julian
Hi

Unfortunately I have the same problem. I'd like to run a java applet which uses Java3D on Mac OSX Mountain Lion.

First I got the same Exception as apoy2k: java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesChooser

I followed the instructions and installed the following libraries:
j3dcore.jar (1.6.0-pre2)
j3dutils.jar (1.6.0-pre2)
vecmath.jar (1.6.0-pre2)

With JOGL2-rc8 and JOGL2-rc10 I still got the following Exception:

Exception in thread "thread applet-PluginTest.class-1"
java.lang.NoClassDefFoundError: javax/media/nativewindow/AbstractGraphicsDevice
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Class.java:169)
     at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:71)
     at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:59)
     at java.security.AccessController.doPrivileged(Native Method)
     at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:88)
     at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:843)
     at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:274)
     at javax.media.j3d.Canvas3D.<clinit>(Canvas3D.java:3829)
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Class.java:169)
     at PluginTest.init(PluginTest.java:44)
     at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1639)
     at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassNotFoundException:
javax.media.nativewindow.AbstractGraphicsDevice
     at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
     at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
     ... 14 more

Do you have a hint, how to solve this problem? Which versions of Java3D, JOGL and OSX are compatible with each other?

Thank you very much for your help!!

Regards Julian