Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Confusing LWJGL Error

  1. #1
    Member
    Join Date
    Jan 2013
    Posts
    34
    My Mood
    Busy
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default Confusing LWJGL Error

    Hello, all! Just today I was going to try create an LWJGL game, I had some experience with Slick2D, and I thought learning LWJGL as well. would be cool.

    But ever since I started trying to make a project from scratch, this is the error I get:

    ---------------------------
    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(AWTSurf aceLock.java:51)
    at org.lwjgl.opengl.AWTSurfaceLock$1.run(AWTSurfaceLo ck.java:94)
    at org.lwjgl.opengl.AWTSurfaceLock$1.run(AWTSurfaceLo ck.java:92)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.opengl.AWTSurfaceLock.privilegedLockAndI nitHandle(AWTSurfaceLock.java:92)
    at org.lwjgl.opengl.AWTSurfaceLock.lockAndGetHandle(A WTSurfaceLock.java:66)
    at org.lwjgl.opengl.MacOSXCanvasPeerInfo.initHandle(M acOSXCanvasPeerInfo.java:57)
    at org.lwjgl.opengl.MacOSXDisplayPeerInfo.doLockAndIn itHandle(MacOSXDisplayPeerInfo.java:56)
    at org.lwjgl.opengl.PeerInfo.lockAndGetHandle(PeerInf o.java:85)
    at org.lwjgl.opengl.MacOSXContextImplementation.creat e(MacOSXContextImplementation.java:47)
    at org.lwjgl.opengl.ContextGL.<init>(ContextGL.java:1 32)
    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 vividmario52.DisplayScreen.start(DisplayScreen.jav a:12)
    at vividmario52.CJAF2D.main(CJAF2D.java:9)
    ---------------------------
    I do not exactly understand this error. Perhaps posting code will help you all try and see what this problem is:

    Main class:
    public class CJAF2D {
     
     
    	public static void main(String[] args) {
    		DisplayScreen ds = new DisplayScreen();
     
    		ds.start(); //Call the start method from DisplayScreen
    	}
     
    }
    DisplayScreen class:
    import org.lwjgl.LWJGLException;
    import org.lwjgl.opengl.*;
    public class DisplayScreen {
     
     
    	public void start(){
    		OnscreenRenderer or = new OnscreenRenderer();
    		try{
    			Display.setDisplayMode(new DisplayMode(640, 480));
    			Display.setTitle("CJAF2D");
    			Display.create();
    		}catch(LWJGLException e){
    			e.printStackTrace();
    			System.exit(0);
    		}
    		GL11.glMatrixMode(GL11.GL_PROJECTION);
    		GL11.glLoadIdentity();
    		GL11.glOrtho(0, 800, 0, 600, 1, -1);
    		GL11.glMatrixMode(GL11.GL_MODELVIEW);
    		while(!Display.isCloseRequested()){
    			or.render(); //Call the render method from the OnscreenRenderer class
    			Display.update();
    		}
    		Display.destroy();
    	}
    }

    And finally, the OnscreenRenderer class:
    import org.lwjgl.opengl.GL11;
    public class OnscreenRenderer {
     
     
    	public void render(){ //Render onscreen stuff
    		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); 
     
     
    	}
    }

    The code doesn't contain any errors, so I'm not sure exactly what's going on.
    Help is appreciated!


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,180
    My Mood
    Hungover
    Thanks
    141
    Thanked 602 Times in 517 Posts

    Default Re: Confusing LWJGL Error

    Let me guess, you're running Java 7 on OSX?

    Recommended reading: [RFE] OSX / Java 7
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. The Following User Says Thank You to KevinWorkman For This Useful Post:

    vividMario52 (February 14th, 2013)

  4. #3
    Member
    Join Date
    Jan 2013
    Posts
    34
    My Mood
    Busy
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default Re: Confusing LWJGL Error

    Thanks so much for the post! I was suspicious the error wasn't my fault, I got the same error when running a fresh decompiled Minecraft. I really wish I had Windows...

Similar Threads

  1. a very confusing exception
    By deathlypest in forum Java Theory & Questions
    Replies: 29
    Last Post: June 11th, 2012, 12:17 PM
  2. Replies: 11
    Last Post: April 5th, 2012, 08:34 PM
  3. What is Abstraction?The Confusing Concept Simplified
    By rainbow9 in forum Java Theory & Questions
    Replies: 1
    Last Post: December 14th, 2011, 10:43 PM
  4. Button help, confusing error.
    By camboy8 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 17th, 2010, 09:25 PM
  5. While (logical confusing output)
    By chronoz13 in forum Loops & Control Statements
    Replies: 4
    Last Post: December 20th, 2009, 12:17 AM