LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Peilot on December 22, 2016, 12:56:24

Title: (CODE IN DESC!) Null pointer exception when using code: glfwShowWindow(window);
Post by: Peilot on December 22, 2016, 12:56:24
I'm using Linux Mint 18 MATE and have the latest nvidia drivers.
This is the code:
Code: [Select]
package Debug;

import static org.lwjgl.glfw.GLFW.*;

public class Main {

public Main() {
initWindow();
}

private void initWindow() {
if (glfwInit() == false) {
System.err.println("GLFW failed to initialize!");
System.exit(-1);
}

long window = glfwCreateWindow(640, 480, "Debug", 0, 0);
glfwShowWindow(window);
}

public static void main(String[] args) {
new Main();
}
}
Title: Re: (CODE IN DESC!) Null pointer exception when using code: glfwShowWindow(window);
Post by: spasi on December 22, 2016, 13:47:27
Could you please try the getting started sample (https://www.lwjgl.org/guide)? You are not setting an error callback so it's hard to say what might be wrong.
Title: Re: (CODE IN DESC!) Null pointer exception when using code: glfwShowWindow(window);
Post by: Peilot on December 22, 2016, 13:48:18
Could you please try the getting started sample (https://www.lwjgl.org/guide)? You are not setting an error callback so it's hard to say what might be wrong.

It has worked before, and I've done it many times, but this is the first time it happens.

Anyways I'll try your example, thanks for answering!