2017-07-25 5 views
0

Ich beginne zu lernen, wie man LWJGL verwendet. Ich schaute auf Youtube und kopierte ein paar Zeilen Code nach unten. Als ich es kompiliert, es funktionierte, aber wenn ich es laufen versucht, hieß es:Wie behebt Bibliothek Fehler beim Laden von Fehler in Eclipse?

[LWJGL] Failed to load a library. Possible solutions: 
    a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath. 
    b) Add the JAR that contains the shared library to the classpath. 
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics. 
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics. 
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl32.so 
    at org.lwjgl.system.Library.loadSystem(Library.java:146) 
    at org.lwjgl.system.Library.loadSystem(Library.java:66) 
    at org.lwjgl.system.Library.<clinit>(Library.java:49) 
    at org.lwjgl.system.MemoryAccessJNI.<clinit>(MemoryAccessJNI.java:13) 
    at org.lwjgl.system.Pointer.<clinit>(Pointer.java:22) 
    at org.lwjgl.system.Platform.mapLibraryNameBundled(Platform.java:80) 
    at org.lwjgl.glfw.GLFW.<clinit>(GLFW.java:602) 
    at Main.main(Main.java:6) 

Dies ist der Code, den ich von Youtube kopiert ist:

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

public class Main { 
    public static void main (String[] args) { 
     if (!glfwInit()) { 
      throw new IllegalStateException("Failed to initialize GLFW!"); 
     } 
     glfwWindowHint(GLFW_VISIBLE,GLFW_FALSE); 
     long window = glfwCreateWindow(640, 480, "My Program", 0, 0); 
     if (window == 0) { 
      throw new IllegalStateException("Failed to create window!"); 
     } 
     GLFWVidMode videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor()); 
     glfwSetWindowPos(window, (videoMode.width() - 640)/2, (videoMode.height() - 480)/2); 
     glfwShowWindow(window); 
     while (!glfwWindowShouldClose(window)) { 
      glfwPollEvents(); 
     } 
    } 
} 

Antwort

0

ein Fehler Dies ist, weil Sie ‚doesn t haben alle Abhängigkeiten in Ihrem Klassenpfad. Sie müssen das LWJGL Glas und alle seine Abhängigkeiten hinzufügen.

Versuchen Sie erneut, diesen Fehler zu beheben (UnsatisfiedLinkError).