Unable to initialize JAWT

Very simple code


import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.awt.GLCanvas;
import javax.swing.JFrame;

import com.sun.opengl.util.Animator;

public class TestJOGL
{
	public static void main(String[] args)
	{
		JFrame frame = new JFrame();
		frame.setSize(640, 480);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		GLCanvas canvas = new GLCanvas();
		canvas.addGLEventListener(new GLEventListener()
		{
			public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4)
			{
			}
			
			public void init(GLAutoDrawable arg0)
			{
			}
			
			public void dispose(GLAutoDrawable arg0)
			{
			}
			
			public void display(GLAutoDrawable arg0)
			{
			}
		});
		Animator animator = new Animator(canvas);
		frame.add(canvas);
		frame.setVisible(true);
	}
}


Exception in thread "main" java.lang.RuntimeException: Unable to initialize JAWT
	at com.sun.nativewindow.impl.jawt.JAWT$1.run(JAWT.java:100)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.nativewindow.impl.jawt.JAWT.getJAWT(JAWT.java:95)
	at com.sun.nativewindow.impl.jawt.windows.WindowsJAWTWindow.lockSurface(WindowsJAWTWindow.java:69)
	at com.sun.opengl.impl.GLDrawableImpl.lockSurface(GLDrawableImpl.java:130)
	at com.sun.opengl.impl.windows.wgl.WindowsWGLDrawable.setRealized(WindowsWGLDrawable.java:70)
	at javax.media.opengl.awt.GLCanvas.addNotify(GLCanvas.java:413)
	at java.awt.Container.addNotify(Container.java:2661)
	at javax.swing.JComponent.addNotify(JComponent.java:4731)
	at java.awt.Container.addNotify(Container.java:2661)
	at javax.swing.JComponent.addNotify(JComponent.java:4731)
	at java.awt.Container.addNotify(Container.java:2661)
	at javax.swing.JComponent.addNotify(JComponent.java:4731)
	at javax.swing.JRootPane.addNotify(JRootPane.java:754)
	at java.awt.Container.addNotify(Container.java:2661)
	at java.awt.Window.addNotify(Window.java:722)
	at java.awt.Frame.addNotify(Frame.java:487)
	at java.awt.Window.show(Window.java:944)
	at java.awt.Component.show(Component.java:1564)
	at java.awt.Component.setVisible(Component.java:1516)
	at java.awt.Window.setVisible(Window.java:927)
	at TestJOGL.main(TestJOGL.java:36)

I don’t understand :frowning:

I’m using JOGL2 latest build.
Java 6 or 7 (same error).
Windows 7 x64
Geforce 8800GTS 640
Latest Nvidia drivers

Thanx !

other errors :


java.lang.Exception: JAWT Surface previously locked by main
	at com.sun.nativewindow.impl.jawt.JAWTWindow.lockSurface(JAWTWindow.java:106)
	at com.sun.nativewindow.impl.jawt.windows.WindowsJAWTWindow.lockSurface(WindowsJAWTWindow.java:60)
	at com.sun.opengl.impl.GLDrawableImpl.lockSurface(GLDrawableImpl.java:130)
	at com.sun.opengl.impl.windows.wgl.WindowsWGLDrawable.setRealized(WindowsWGLDrawable.java:70)
	at javax.media.opengl.awt.GLCanvas.addNotify(GLCanvas.java:413)
	at java.awt.Container.addNotify(Container.java:2661)
	at javax.swing.JComponent.addNotify(JComponent.java:4731)
	at java.awt.Container.addNotify(Container.java:2661)
	at javax.swing.JComponent.addNotify(JComponent.java:4731)
	at java.awt.Container.addNotify(Container.java:2661)
	at javax.swing.JComponent.addNotify(JComponent.java:4731)
	at javax.swing.JRootPane.addNotify(JRootPane.java:754)
	at java.awt.Container.addNotify(Container.java:2661)
	at java.awt.Window.addNotify(Window.java:722)
	at java.awt.Frame.addNotify(Frame.java:487)
	at java.awt.Window.show(Window.java:944)
	at java.awt.Component.show(Component.java:1564)
	at java.awt.Component.setVisible(Component.java:1516)
	at java.awt.Window.setVisible(Window.java:927)
	at TestJOGL.main(TestJOGL.java:36)
Exception in thread "AWT-EventQueue-0" javax.media.nativewindow.NativeWindowException: JAWT Surface already locked - AWT-EventQueue-0 JAWT-Window[windowHandle 0x0, surfaceHandle 0x0, pos 0/0, size 624x442, visible true, locked true,
	config class javax.media.nativewindow.awt.AWTGraphicsConfiguration[class javax.media.nativewindow.awt.AWTGraphicsScreen[class javax.media.nativewindow.awt.AWTGraphicsDevice[type AWT, awtDevice D3DGraphicsDevice[screen=0], handle 0x0], idx 0],
	chosen    GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: false, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 0, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false],
	requested GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: false, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 0, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false],
	D3DGraphicsConfig[dev=D3DGraphicsDevice[screen=0],pixfmt=0],
	encapsulated WindowsWGLGraphicsConfiguration[class javax.media.nativewindow.DefaultGraphicsScreen[class javax.media.nativewindow.windows.WindowsGraphicsDevice[type Windows, handle 0x0], idx 0], pfdID -1, wglChoosen false,
	requested GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: false, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 0, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false],
	chosen    GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: false, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 0, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false]]],
	wrappedWindow AWT-GLCanvas[ class javax.media.nativewindow.awt.AWTGraphicsConfiguration[class javax.media.nativewindow.awt.AWTGraphicsScreen[class javax.media.nativewindow.awt.AWTGraphicsDevice[type AWT, awtDevice D3DGraphicsDevice[screen=0], handle 0x0], idx 0],
	chosen    GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: false, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 0, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false],
	requested GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: false, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 0, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false],
	D3DGraphicsConfig[dev=D3DGraphicsDevice[screen=0],pixfmt=0],
	encapsulated WindowsWGLGraphicsConfiguration[class javax.media.nativewindow.DefaultGraphicsScreen[class javax.media.nativewindow.windows.WindowsGraphicsDevice[type Windows, handle 0x0], idx 0], pfdID -1, wglChoosen false,
	requested GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: false, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 0, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false],
	chosen    GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: false, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 0, Red Accum: 0, Green Accum: 0, Blue Accum: 0, Alpha Accum: 0, Multisample: false, Num samples: 0, PBuffer-FloatingPointBuffers: false, PBuffer-RenderToTexture: false, PBuffer-RenderToTextureRectangle: false]]], com.sun.opengl.impl.windows.wgl.WindowsOnscreenWGLDrawable, GLEventListeners num 1 [TestJOGL$1@329f3d, ]]]
	at com.sun.nativewindow.impl.jawt.JAWTWindow.lockSurface(JAWTWindow.java:104)
	at com.sun.nativewindow.impl.jawt.windows.WindowsJAWTWindow.lockSurface(WindowsJAWTWindow.java:60)
	at com.sun.opengl.impl.GLDrawableImpl.lockSurface(GLDrawableImpl.java:130)
	at com.sun.opengl.impl.windows.wgl.WindowsOnscreenWGLContext.makeCurrentImpl(WindowsOnscreenWGLContext.java:59)
	at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:120)
	at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:141)
	at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:553)
	at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:290)
	at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:368)
	at sun.awt.RepaintArea.paintComponent(RepaintArea.java:264)
	at sun.awt.RepaintArea.paint(RepaintArea.java:240)
	at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:347)
	at java.awt.Component.dispatchEventImpl(Component.java:4777)
	at java.awt.Component.dispatchEvent(Component.java:4527)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:286)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:191)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:186)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:139)
Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: Attempt to make the same context current twice on thread Thread[AWT-EventQueue-0,6,main]
	at com.sun.opengl.impl.GLContextLock.lock(GLContextLock.java:83)
	at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:117)
	at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:141)
	at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:553)
	at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:290)
	at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:368)
	at sun.awt.RepaintArea.paintComponent(RepaintArea.java:264)
	at sun.awt.RepaintArea.paint(RepaintArea.java:240)
	at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:347)
	at java.awt.Component.dispatchEventImpl(Component.java:4777)
	at java.awt.Component.dispatchEvent(Component.java:4527)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:286)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:191)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:186)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:139)

Is there anyone else who can reproduce this bug? I have no access to Windows 7. JOGL 2 works fine under Vista as far as I know.

Is it a Windows 7 bug ?
I can test it on others computers tomorrow :

  • Win 7 x64
  • Win XP 32

Enable or disable Aero doesn’t fix the bug

Do you use noddraw=true ?

//Disable DirectDraw under Windows in order to avoid conflicts with OpenGL
    	System.setProperty("sun.java2d.noddraw","true");

What is “noddraw” ?
All my code is in the first message.

noddraw = no Direct Draw

Use the line I gave you in my previous post. If you can launch TUER, it means that there is no bug :slight_smile:

The first line of your program should be

System.setProperty("sun.java2d.noddraw","true");

or use this option on command line.

Let me know if it works.

Doesn’t work :frowning:

But i can launch and play TUER.

System.setProperty(“sun.java2d.noddraw”,“true”);
removed 3 exceptions

Here my new code :


public class TestJOGL
{
	public static void main(String[] args)
	{
		System.setProperty("sun.java2d.noddraw", "true");
		
		JFrame frame = new JFrame();
		frame.setSize(640, 480);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		GLCanvas canvas = new GLCanvas();
		canvas.addGLEventListener(new GLEventListener()
		{
			public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4)
			{
			}
			
			public void init(GLAutoDrawable arg0)
			{
			}
			
			public void dispose(GLAutoDrawable arg0)
			{
			}
			
			public void display(GLAutoDrawable arg0)
			{
			}
		});
		Animator animator = new Animator(canvas);
		frame.add(canvas);
		frame.setVisible(true);
	}
}

Error message :


Exception in thread "main" java.lang.RuntimeException: Unable to initialize JAWT
	at com.sun.nativewindow.impl.jawt.JAWT$1.run(JAWT.java:100)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.nativewindow.impl.jawt.JAWT.getJAWT(JAWT.java:95)
	at com.sun.nativewindow.impl.jawt.windows.WindowsJAWTWindow.lockSurface(WindowsJAWTWindow.java:69)
	at com.sun.opengl.impl.GLDrawableImpl.lockSurface(GLDrawableImpl.java:130)
	at com.sun.opengl.impl.windows.wgl.WindowsWGLDrawable.setRealized(WindowsWGLDrawable.java:70)
	at javax.media.opengl.awt.GLCanvas.addNotify(GLCanvas.java:413)
	at java.awt.Container.addNotify(Container.java:2661)
	at javax.swing.JComponent.addNotify(JComponent.java:4731)
	at java.awt.Container.addNotify(Container.java:2661)
	at javax.swing.JComponent.addNotify(JComponent.java:4731)
	at java.awt.Container.addNotify(Container.java:2661)
	at javax.swing.JComponent.addNotify(JComponent.java:4731)
	at javax.swing.JRootPane.addNotify(JRootPane.java:754)
	at java.awt.Container.addNotify(Container.java:2661)
	at java.awt.Window.addNotify(Window.java:722)
	at java.awt.Frame.addNotify(Frame.java:487)
	at java.awt.Window.show(Window.java:944)
	at java.awt.Component.show(Component.java:1564)
	at java.awt.Component.setVisible(Component.java:1516)
	at java.awt.Window.setVisible(Window.java:927)
	at TestJOGL.main(TestJOGL.java:38)


I use Eclipse.
All .jar and .dll files are in a “lib” folder in my project,
and are imported as “libraries” in my project properties.

All .dll files are also in my project root folder.

It is strange, I don’t see:

public final void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged){}

in your code ???

Please can you try to do the same with an AWT frame instead of a JFrame?

http://download.java.net/media/jogl/jogl-2.x-docs/javax/media/opengl/GLEventListener.html

displayChanged is in the 1.1.1 doc
not in 2.x

You’re right… but do you reproduce your bug with a plain AWT frame instead of a JFrame?

same bug with a Frame

i can give you a VNC access on my computer (tomorrow), if you want to test this bug :stuck_out_tongue:

My Internet connection is too bad :’( Please test under Windows XP and/or Windows Vista tomorrow. If you reproduce this bug on one of them, it will be easier for me, it will allow me to try to test it at work (I have no Windows at all at home ;D).

Is it really a blocker bug for you? Can you use JOGL 1.1.1a until this is fixed?

ok, i’ll test tomorrow.
yes this bug is blocker, i can’t use JOGL 2 :stuck_out_tongue:
About using 1.1.1 … I don’t like using “old” API ^^
JOGL 1 and 2 are not exactly the same, and i don’t want to change my code when JOGL 2 will be stable…

Just take in count that Jogl 1.1.1a is not web-startable on Mac OSX with Java 1.6

One year or even 6 months ago, it was not such an issue.
But nowadays, more and more Mac’s are simply getting automatically updated to Java 1.6…

I remind you that JOGL 1.1.1a is stable whereas JOGL 2 is only at a beta stage. You won’t have a lot of things to change to switch from one version to another and I see you don’t use Newt, it decreases the “cost” of such changes. JOGL is now a community-driven project, Sun has given it up, it is difficult to maintain such an API. If you do not yet use any feature that is specific to JOGL 2, switching back to JOGL 1.1.1a is not a problem. Best regards.

You’re right, it is a big problem, I agree with you. You know that JOGL developers already do what they can to prevent the boat from sinking… :-\ Is it different with JOGL 2 on Mac?

Is JOGL dead ?