LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: DeafMan1983 on April 23, 2022, 14:51:11

Title: Problem with LWJGL 3.3x I have followed step to step
Post by: DeafMan1983 on April 23, 2022, 14:51:11
Hello everyone

I have readden docummentation like I have create name "LWJGL3" in User libraries from Eclipse
And add customizated jars from Build and Download

Then I have created LWJGL3 project and I have set up Build Path -> Libraries add Libraries -> User Library -> LWJGL3 then it get successfully.
It works fine.

Then I create DisplayManager.java
like this

import org.lwjgl.glfw.*;

public class DisplayManager {

private boolean status;
private long window;

public final static DisplayManager Create(String title, int width, int height)
{
DisplayManager dmClass = new DisplayManager();
dmClass.status = GLFW.glfwInit();
if (!dmClass.status)
{
System.out.printf("Error: Initializing with GLFW 3, %s \n", dmClass.status);
}
else {
dmClass.window = GLFW.glfwCreateWindow(width, height, title, 0, 0);
if (dmClass.window == 0)
{
System.err.printf("Error: Creating GLFWWindow %s", dmClass.window);
}
}

return dmClass;
}

public void Make()
{
GLFW.glfwMakeContextCurrent(this.window);
}

public boolean IsRunning()
{
return !GLFW.glfwWindowShouldClose(this.window);
}

public void HandleClose()
{
if (GLFW.glfwGetKey(window, GLFW.GLFW_KEY_ESCAPE) == GLFW.GLFW_PRESS)
GLFW.glfwSetWindowShouldClose(this.window, true);
}

public void Poll()
{
GLFW.glfwSwapBuffers(this.window);
GLFW.glfwPollEvents();
}

public void Destroy()
{
GLFW.glfwDestroyWindow(this.window);
}

public long GetWindow()
{
return window;
}
}


and MainApp.java with static void main()
public class MainApp {

private static DisplayManager dm;

public static void main(String[] args) {
dm = DisplayManager.Create("Hello Window", 1280, 800);

dm.Make();

while (dm.IsRunning())
{
dm.HandleClose();

// Rendering

dm.Poll();
}

dm.Destroy();
}
}


Then Eclipse throws error what is that? I never did fail anything. I have proof.
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/glfw/GLFW
at DisplayManager.Create(DisplayManager.java:11)
at MainApp.main(MainApp.java:6)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.glfw.GLFW
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 2 more

But why?? I have told I have downloaded like this in screenshot
(https://i.imgur.com/ZTFOpx2.png)

Why does it happen? I never fail that.

I already make sure that Creating name in UserLibrary then add external jars then make sure for LWJGL3

How do I fix? If I am wrong?

thank you!