Reputation: 451
I'm new to game making and LWJGL, and I want to create a basic window. Here is my code :
if (!glfwInit()) {
System.out.println("Failed to initialize GLFW");
System.exit(1);
}
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
window = glfwCreateWindow(this.SCREEN_WIDTH, this.SCREEN_HEIGHT,
"Hello World", MemoryUtil.NULL, MemoryUtil.NULL);
if (window == MemoryUtil.NULL) {
System.out.println("Failed to create window");
System.exit(1);
}
glfwMakeContextCurrent(window);
GL.createCapabilities();
glfwSwapInterval(1);
But when I execute the code, I keep getting:
Failed to create window
Process finished with exit code 1
I'm following this tutorial on GitHub:
Can someone show me what caused this to happen. Any help would be appreciated!
Upvotes: 0
Views: 523
Reputation: 451
I have found the answer. After reading some articles on the web, it appears that downgrading Java was a solution that worked for a considerable number of people. So I tried installing Java Update 51 and everything is running smoothly now.
Upvotes: 0