LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: xShane on March 17, 2013, 05:31:06

Title: [ERROR] Need Help Fixing This Error
Post by: xShane on March 17, 2013, 05:31:06
Hey,

IDE: Eclipse 4.2.2
OS: Mac OSX Mountain Lion (10.8.3)
Java: 1.7
LWJGL: Latest?

I recently *just* got around to installing Eclipse and LWJGL. I have previous experience with Java via a college-level course (in high school) in computer science. I recently just got done "learning" (more like "toying") with Objective-C and OSX/iOS development. I've been wanting to do Java game development for quite some time now.

Anyhow,
I was completing the very first basic tutorial regarding displays. My code is basically exactly the same as provided in the example:

http://www.lwjgl.org/wiki/index.php?title=LWJGL_Basics_1_%28The_Display%29


import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

public class MainTest
{

public void start()
{
try
{
Display.setDisplayMode(new DisplayMode(800, 600));
Display.create();
} catch (LWJGLException e)
{
e.printStackTrace();
System.exit(0);
}

//init OpenGL here

while (!Display.isCloseRequested() )
{
//render OpenGL here
Display.update();
}

Display.destroy();
}

public static void main(String[] args)
{
MainTest mainTest = new MainTest();
mainTest.start();
}
}


When running, the created window/display flashes for barely a fraction of a second and I get this error in the console:

Quote
JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
org.lwjgl.LWJGLException: Could not get the JAWT interface
   at org.lwjgl.opengl.AWTSurfaceLock.lockAndInitHandle(Native Method)
   at org.lwjgl.opengl.AWTSurfaceLock.access$100(AWTSurfaceLock.java:51)
   at org.lwjgl.opengl.AWTSurfaceLock$1.run(AWTSurfaceLock.java:94)
   at org.lwjgl.opengl.AWTSurfaceLock$1.run(AWTSurfaceLock.java:92)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.lwjgl.opengl.AWTSurfaceLock.privilegedLockAndInitHandle(AWTSurfaceLock.java:92)
   at org.lwjgl.opengl.AWTSurfaceLock.lockAndGetHandle(AWTSurfaceLock.java:66)
   at org.lwjgl.opengl.MacOSXCanvasPeerInfo.initHandle(MacOSXCanvasPeerInfo.java:57)
   at org.lwjgl.opengl.MacOSXDisplayPeerInfo.doLockAndInitHandle(MacOSXDisplayPeerInfo.java:56)
   at org.lwjgl.opengl.PeerInfo.lockAndGetHandle(PeerInfo.java:85)
   at org.lwjgl.opengl.MacOSXContextImplementation.create(MacOSXContextImplementation.java:47)
   at org.lwjgl.opengl.ContextGL.<init>(ContextGL.java:132)
   at org.lwjgl.opengl.Display.create(Display.java:847)
   at org.lwjgl.opengl.Display.create(Display.java:754)
   at org.lwjgl.opengl.Display.create(Display.java:736)
   at MainTest.start(MainTest.java:15)
   at MainTest.main(MainTest.java:36)

I do believe I properly set up LWJGL to work with Eclipse (following the providing installation documentation).

Cheers,
Shane
Title: Re: [ERROR] Need Help Fixing This Error
Post by: quew8 on March 17, 2013, 08:48:24
http://lwjgl.org/forum/index.php/topic,4711.0.html (http://lwjgl.org/forum/index.php/topic,4711.0.html) I believe this is you problem.
Title: Re: [ERROR] Need Help Fixing This Error
Post by: xShane on March 17, 2013, 18:06:07
Quote from: quew8 on March 17, 2013, 08:48:24
http://lwjgl.org/forum/index.php/topic,4711.0.html (http://lwjgl.org/forum/index.php/topic,4711.0.html) I believe this is you problem.

Yupp, unfortunately it appears so.

I guess my only option is to downgrade to a different version of Java? Or maybe switch to Ubuntu/Linux for developing until it gets fixed?
Title: Re: [ERROR] Need Help Fixing This Error
Post by: kappa on March 17, 2013, 18:51:14
Quote from: xShane on March 17, 2013, 18:06:07
Yupp, unfortunately it appears so.

I guess my only option is to downgrade to a different version of Java? Or maybe switch to Ubuntu/Linux for developing until it gets fixed?
Or use the nightly builds for LWJGL 2.9 (https://www.dropbox.com/s/b6gj27dmoyo0h0j/macosx.zip) provided in that thread and carry on using OS X and Java 7.
Title: Re: [ERROR] Need Help Fixing This Error
Post by: xShane on March 17, 2013, 19:08:47
Quote from: kappa on March 17, 2013, 18:51:14
Quote from: xShane on March 17, 2013, 18:06:07
Yupp, unfortunately it appears so.

I guess my only option is to downgrade to a different version of Java? Or maybe switch to Ubuntu/Linux for developing until it gets fixed?
Or use the nightly builds for LWJGL 2.9 (https://www.dropbox.com/s/b6gj27dmoyo0h0j/macosx.zip) provided in that thread and carry on using OS X and Java 7.

Awesome. What are the current downsides to using a nightly build (I understand what it is)?

EDIT: Just tried 2.9. Still get the same error as before. I reverted back to 2.8.5 and also will use Java 6 instead of Java 7 until things get sorted out. Alternatively, should I use Linux/Ubuntu and then port back to Mac when things are fixed?
Title: Re: [ERROR] Need Help Fixing This Error
Post by: kappa on March 18, 2013, 14:53:17
You really shouldn't get that error with the lwjgl 2.9 builds when running your above test case, just make sure you replaced the jars/natives properly.

Try call

System.out.println("LWJGL VERSION: " + Sys.getVersion());

At the beginning of your application to double check that you've replaced the jars/natives properly to LWJGL 2.9.
Title: Re: [ERROR] Need Help Fixing This Error
Post by: xShane on March 18, 2013, 21:07:44
Quote from: kappa on March 18, 2013, 14:53:17
You really shouldn't get that error with the lwjgl 2.9 builds when running your above test case, just make sure you replaced the jars/natives properly.

Try call

System.out.println("LWJGL VERSION: " + Sys.getVersion());

At the beginning of your application to double check that you've replaced the jars/natives properly to LWJGL 2.9.

Just double checked, it printed 2.9.0, but still get the error (while on Java 7 w/ lwjgl 2.9.0).