Netbeans RCP + LWJGL

Hi, I’ve been working on a game engine. It uses the LWJGL, Artemis Entity Component System, and TWL Gui libraries. I have a fully working entity component based engine that loads and renders 3d models with modern gl (VBO GLSL based). However I want to put it into a netbeans rcp platform module.
The only resource I can find on this is http://netbeans.dzone.com/lwjgl-nb
However this causes problems with input and TWL, not to mention AWTGLCanvas was deprecated due to Display.setParent. But that causes a Display parent must be displayable error.
Any ideas?

Extra info: I complied my engine into a jar and imported it, LWJGL, TWL, Artemis all as wrapped jars. Natives are loaded with System.loadNatives

Self reply incase anyone googles this.
Got it working!

To make LWJGL work with the Netbeans RCP Platform create a class that extends java.awt.Canvas
In the constructor put


while (!isDisplayable()) {Thread.yield();} //This is the magical line that took me a week to figure out, a little hacky
try {
	Display.setDisplayMode(new DisplayMode(640, 480));
	Display.setVSyncEnabled(false);
	Display.setParent(this); //Magic.
	Display.create();
} catch (LWJGLException ex) {
	System.err.println("Display could not be created");
	ex.printStackTrace(System.err);
	System.exit(-1);
}

Then create and add the canvas to your module. If your using the netbeans GUI designer make sure there is a no argument constructor in your canvas and go to Tools>Add to Palette and choose your canvas from project etc (If you have the file open in the editor it will ask which category to put the file in, netbeans is awesome).

I get some handled exceptions when I run it, but it runs fine regardless. E.g:

java.lang.Exception: Dangerous reflection access to sun.misc.Unsafe by class org.lwjgl.MemoryUtilSun$AccessorUnsafe detected!
[catch] at org.netbeans.TopSecurityManager.checkMemberAccess(TopSecurityManager.java:440)
	at java.lang.Class.checkMemberAccess(Class.java:2233)
	at java.lang.Class.getDeclaredFields(Class.java:1795)
	at org.lwjgl.MemoryUtilSun$AccessorUnsafe.getUnsafeInstance(MemoryUtilSun.java:74)
	at org.lwjgl.MemoryUtilSun$AccessorUnsafe.<init>(MemoryUtilSun.java:62)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at java.lang.Class.newInstance(Class.java:374)
	at org.lwjgl.MemoryUtil.loadAccessor(MemoryUtil.java:375)
	at org.lwjgl.MemoryUtil.<clinit>(MemoryUtil.java:63)
	at org.lwjgl.opengl.LinuxDisplay.setTitle(LinuxDisplay.java:759)
	at org.lwjgl.opengl.Display.setTitle(Display.java:541)
	at org.lwjgl.opengl.Display.createWindow(Display.java:312)
	at org.lwjgl.opengl.Display.create(Display.java:848)
	at org.lwjgl.opengl.Display.create(Display.java:757)
	at org.lwjgl.opengl.Display.create(Display.java:739)
	at Core.Main.run(Main.java:34)
	at java.lang.Thread.run(Thread.java:724)
org.lwjgl.LWJGLException: X Error - disp: 0x7fc54c38cac0 serial: 8409 error: BadDrawable (invalid Pixmap or Window parameter) request_code: 153 minor_code: 8
	at org.lwjgl.opengl.LinuxDisplay.globalErrorHandler(LinuxDisplay.java:318)
	at org.lwjgl.opengl.LinuxContextImplementation.nSwapBuffers(Native Method)
	at org.lwjgl.opengl.LinuxContextImplementation.swapBuffers(LinuxContextImplementation.java:79)
	at org.lwjgl.opengl.ContextGL.swapBuffers(ContextGL.java:175)
	at org.lwjgl.opengl.DrawableGL.swapBuffers(DrawableGL.java:90)
	at org.lwjgl.opengl.Display.swapBuffers(Display.java:618)
	at org.lwjgl.opengl.Display.update(Display.java:646)
Caused: java.lang.RuntimeException
	at org.lwjgl.opengl.Display.update(Display.java:648)
	at org.lwjgl.opengl.Display.update(Display.java:628)
	at Core.Main.run(Main.java:93)
[catch] at java.lang.Thread.run(Thread.java:724)

GL HF

http://lwjgl.org/forum/index.php/topic,5129.0.html

Reported bug on lwjgl forum. I will get this to work.

You should switch to Netbeans Platform 7.3.1, it contains a fix that avoids the exception about dangerous reflection access (it doesn’t force the application to quit).