FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 890 : Problem with using Processing/OpenGL in Eclipse
Last modified: 2008-08-21 17:25
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
RESOLVED
Resolution:
INVALID -
Pr
i
ority:
P2
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
adm
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2008-08-21 14:54
In all of the recent releases (at least 0144 and on), I encounter an error
when trying to run any Processing applet in Eclipse that uses OpenGL.
Currently this is happening with the recent 0148 release. I am using OS X
10.5.4 on a MacBook Pro with an ATI x1600.
The source of the problem appears to be the native libraries that
opengl.jar references. I am using all .jars from 0148 (opengl.jar,
core.jar, jogl.jar) in my Java build path, but with the native library
location set to the ones inlcluded in 0148, I get an error and the applet
will not run. If I keep using all the same .jars, but set the native
library location to those that come with 0135, it works ok.
This code in an Eclipse project will reproduce the error:
import processing.core.*;
import processing.opengl.*;
public class EmptyApp extends PApplet
{
public void setup()
{
size(640,480,OPENGL);
}
}
Here is what it spits out into the console:
Error while running applet.
java.lang.RuntimeException: java.lang.ClassCastException:
java.nio.DirectByteBuffer
at processing.opengl.PGraphicsOpenGL.requestDisplay(PGraphicsOpenGL.java:172)
at processing.core.PApplet.run(PApplet.java:1562)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.ClassCastException: java.nio.DirectByteBuffer
at
com.sun.opengl.impl.macosx.MacOSXOnscreenGLDrawable.lockSurface(MacOSXOnscreenGLDrawable.java:177)
at
com.sun.opengl.impl.macosx.MacOSXOnscreenGLContext.makeCurrentImpl(MacOSXOnscreenGLContext.java:57)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:127)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
at
javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:298)
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)
java.lang.RuntimeException: java.lang.ClassCastException:
java.nio.DirectByteBufferException in thread "AWT-EventQueue-1"
javax.media.opengl.GLException: Attempt to make the same context current
twice on thread
Thread[AWT-EventQueue-1,4,file:/Users/ameyers/Documents/workspace/DataOrgy/bin/-threadGroup]
at com.sun.opengl.impl.GLContextLock.lock(GLContextLock.java:83)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:124)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
at
javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:258)
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:268)
at java.awt.Component.dispatchEventImpl(Component.java:4144)
at java.awt.Component.dispatchEvent(Component.java:3903)
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)
at processing.opengl.PGraphicsOpenGL.requestDisplay(PGraphicsOpenGL.java:172)
at processing.core.PApplet.run(PApplet.java:1562)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.ClassCastException: java.nio.DirectByteBuffer
at
com.sun.opengl.impl.macosx.MacOSXOnscreenGLDrawable.lockSurface(MacOSXOnscreenGLDrawable.java:177)
at
com.sun.opengl.impl.macosx.MacOSXOnscreenGLContext.makeCurrentImpl(MacOSXOnscreenGLContext.java:57)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:127)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
at
javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:298)
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)
Additional Comment
#1 From fry 2008-08-21 16:04
This is not a Processing bug, your classpath is messed up. The method
requestDisplay() no longer exists in release 0145 and later. This is the
sort of thing that you avoid by using the PDE but when using Eclipse,
you're on your own.
Additional Comment
#2 From splat 2008-08-21 17:17
Hmmm...
Well, the error that you posted makes no sense (and references an older
jar), but I think there might be some validity to this issue.
Something has changed about the OpenGL configuration which prevents the old
methods of using Processing with Eclipse. I'm not saying this is a "bug"
per-se, but there is probably a new way of setting up Eclipse that we need
to discover.
I consistently get the following error with the files from 148 on OSX:
java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
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:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
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:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:108)
at processing.opengl.PGraphicsOpenGL.allocate(PGraphicsOpenGL.java:183)
at processing.core.PGraphics3D.resize(PGraphics3D.java:245)
at processing.core.PGraphics.<init>(PGraphics.java:656)
at processing.core.PGraphics3D.<init>(PGraphics3D.java:220)
at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:112)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at processing.core.PApplet.makeGraphics(PApplet.java:1153)
at processing.core.PApplet.size(PApplet.java:1003)
at processing.core.PApplet.size(PApplet.java:947)
at P5Test.setup(P5Test.java:8)
at processing.core.PApplet.handleDraw(PApplet.java:1377)
at processing.core.PApplet.run(PApplet.java:1305)
at java.lang.Thread.run(Thread.java:613)
java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
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:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
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:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:108)
at processing.opengl.PGraphicsOpenGL.allocate(PGraphicsOpenGL.java:183)
at processing.core.PGraphics3D.resize(PGraphics3D.java:245)
at processing.core.PGraphics.<init>(PGraphics.java:656)
at processing.core.PGraphics3D.<init>(PGraphics3D.java:220)
at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:112)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at processing.core.PApplet.makeGraphics(PApplet.java:1153)
at processing.core.PApplet.size(PApplet.java:1003)
at processing.core.PApplet.size(PApplet.java:947)
at P5Test.setup(P5Test.java:8)
at processing.core.PApplet.handleDraw(PApplet.java:1377)
at processing.core.PApplet.run(PApplet.java:1305)
at java.lang.Thread.run(Thread.java:613)
Exception in thread "Animation Thread" java.lang.RuntimeException:
com/sun/gluegen/runtime/DynamicLookupHelper
at processing.core.PApplet.makeGraphics(PApplet.java:1171)
at processing.core.PApplet.size(PApplet.java:1003)
at processing.core.PApplet.size(PApplet.java:947)
at P5Test.setup(P5Test.java:8)
at processing.core.PApplet.handleDraw(PApplet.java:1377)
at processing.core.PApplet.run(PApplet.java:1305)
at java.lang.Thread.run(Thread.java:613)
Additional Comment
#3 From splat 2008-08-21 17:21
... and I bet it's simply adding gluegen-rt.jar ... dur... checking...
(In reply to
comment #2
)
>
>
>
> Additional
Comment #2
From
>
> splat
> 2008-08-21 17:17
>
> <!--
> addReplyLink(2); //-->[reply]
>
>
>
>
> Hmmm...
>
> Well, the error that you posted makes no sense (and references an older
> jar), but I think there might be some validity to this issue.
>
> Something has changed about the OpenGL configuration which prevents the old
> methods of using Processing with Eclipse. I'm not saying this is a "bug"
> per-se, but there is probably a new way of setting up Eclipse that we need
> to discover.
>
> I consistently get the following error with the files from 148 on OSX:
>
>
> java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
> 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:316)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
> 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:316)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:164)
> at
javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:108)
> at processing.opengl.PGraphicsOpenGL.allocate(PGraphicsOpenGL.java:183)
> at processing.core.PGraphics3D.resize(PGraphics3D.java:245)
> at processing.core.PGraphics.<init>(PGraphics.java:656)
> at processing.core.PGraphics3D.<init>(PGraphics3D.java:220)
> at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:112)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
>
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at
>
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at processing.core.PApplet.makeGraphics(PApplet.java:1153)
> at processing.core.PApplet.size(PApplet.java:1003)
> at processing.core.PApplet.size(PApplet.java:947)
> at P5Test.setup(P5Test.java:8)
> at processing.core.PApplet.handleDraw(PApplet.java:1377)
> at processing.core.PApplet.run(PApplet.java:1305)
> at java.lang.Thread.run(Thread.java:613)
> java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
> 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:316)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
> 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:316)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:164)
> at
javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:108)
> at processing.opengl.PGraphicsOpenGL.allocate(PGraphicsOpenGL.java:183)
> at processing.core.PGraphics3D.resize(PGraphics3D.java:245)
> at processing.core.PGraphics.<init>(PGraphics.java:656)
> at processing.core.PGraphics3D.<init>(PGraphics3D.java:220)
> at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:112)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
>
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at
>
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> at processing.core.PApplet.makeGraphics(PApplet.java:1153)
> at processing.core.PApplet.size(PApplet.java:1003)
> at processing.core.PApplet.size(PApplet.java:947)
> at P5Test.setup(P5Test.java:8)
> at processing.core.PApplet.handleDraw(PApplet.java:1377)
> at processing.core.PApplet.run(PApplet.java:1305)
> at java.lang.Thread.run(Thread.java:613)
> Exception in thread "Animation Thread" java.lang.RuntimeException:
> com/sun/gluegen/runtime/DynamicLookupHelper
> at processing.core.PApplet.makeGraphics(PApplet.java:1171)
> at processing.core.PApplet.size(PApplet.java:1003)
> at processing.core.PApplet.size(PApplet.java:947)
> at P5Test.setup(P5Test.java:8)
> at processing.core.PApplet.handleDraw(PApplet.java:1377)
> at processing.core.PApplet.run(PApplet.java:1305)
> at java.lang.Thread.run(Thread.java:613)
>
>
Additional Comment
#4 From splat 2008-08-21 17:25
Sure enough... just needed to add "gluegen-rt.jar" ... Sorry for taking up
bug space Ben!!