Linux에서 'lwjgl'로 작업하려고 시도했지만 터미널에서 컴파일 된 코드를 실행할 때 문제가 발생했습니다. lwjgl 3의 안정적인 릴리스를 사용하고 있습니다.LWJGL : 라이브러리를로드하지 못했습니다.
웹 사이트에서 lwjgl.jar을 다운로드하고 코드를 잘 컴파일하는 javac -cp lwjgl.jar: Main.java
명령을 실행합니다. 그럼 난 : java -cp lwjgl.jar: Main
후이 오류를 throw합니다;
[LWJGL] Failed to load a library. Possible solutions:
a) Set -Djava.library.path or -Dorg.lwjgl.librarypath to the directory that contains the shared libraries.
b) Add the JAR(s) containing the shared libraries to the classpath.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
Exception in thread "EndlessRunner" java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.so
at org.lwjgl.system.Library.loadSystemRelative(Library.java:100)
at org.lwjgl.system.Library.loadSystem(Library.java:71)
at org.lwjgl.system.Library.<clinit>(Library.java:43)
at org.lwjgl.system.MemoryAccess.<clinit>(MemoryAccess.java:17)
at org.lwjgl.system.Pointer.<clinit>(Pointer.java:22)
at org.lwjgl.glfw.GLFW.<clinit>(GLFW.java:562)
at Main.init(Main.java:31)
at Main.run(Main.java:78)
at java.lang.Thread.run(Thread.java:745)
필자도 필자가 필요로하는 일부 파일을 놓친 것인지 아니면 완전히 잘못된 길로 가고 있는지 확실하지 않습니다. 다음은 사용중인 코드입니다. 온라인에서 찾은 것 중 일부이며 테스트로 사용하고 있습니다.
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.system.MemoryUtil.*;
import java.nio.ByteBuffer;
import org.lwjgl.glfw.GLFWVidMode;
public class Main implements Runnable{
private Thread thread;
public boolean running = true;
private long window;
private int width = 1200, height = 800;
public static void main(String args[]){
Main game = new Main();
game.start();
}
public void start(){
running = true;
thread = new Thread(this, "EndlessRunner");
thread.start();
}
public void init(){
// Initializes our window creator library - GLFW
// This basically means, if this glfwInit() doesn't run properlly
// print an error to the console
if(glfwInit() != true){
// Throw an error.
System.err.println("GLFW initialization failed!");
}
// Allows our window to be resizable
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
// Creates our window. You'll need to declare private long window at the
// top of the class though.
// We pass the width and height of the game we want as well as the title for
// the window. The last 2 NULL parameters are for more advanced uses and you
// shouldn't worry about them right now.
window = glfwCreateWindow(width, height, "Endless Runner", NULL, NULL);
// This code performs the appropriate checks to ensure that the
// window was successfully created.
// If not then it prints an error to the console
if(window == NULL){
// Throw an Error
System.err.println("Could not create our Window!");
}
// creates a bytebuffer object 'vidmode' which then queries
// to see what the primary monitor is.
//ByteBuffer vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
// Sets the initial position of our game window.
glfwSetWindowPos(window, 100, 100);
// Sets the context of GLFW, this is vital for our program to work.
glfwMakeContextCurrent(window);
// finally shows our created window in all it's glory.
glfwShowWindow(window);
}
public void update(){
// Polls for any window events such as the window closing etc.
glfwPollEvents();
}
public void render(){
// Swaps out our buffers
glfwSwapBuffers(window);
}
@Override
public void run() {
// All our initialization code
init();
// Our main game loop
while(running){
update();
render();
// Checks to see if either the escape button or the
// red cross at the top were pressed.
// if so sets our boolean to false and closes the
// thread.
if(glfwWindowShouldClose(window) == true){
running = false;
}
}
}
}
는 너희들이 줄 수있는 어떤 도움은 매우 극명하게 될 것이다.
감사합니다.
일반적으로 오류는 매우 일반적이며 사용자의 설명은 그다지 구체적이지 않습니다. 메시지는 다음과 같이 말합니다 : 네이티브 라이브러리를 찾을 수 없습니다. * JAR과 더불어 * 웹 사이트에서 다운로드 한 ZIP 패키지에 포함되어있는'liblwjgl.so'도 필요합니다. 첫 번째 테스트의 경우,이'liblwjgl.so'를 프로젝트의 기본 디렉토리에 넣고 작동하는지 확인하십시오. 작동한다면 네이티브 라이브러리 로딩과'java.library.path'에 대해 더 많이 읽을 수 있습니다. – Marco13
'공유 라이브러리가있는 디렉토리에 -Djava.library.path 또는 -Dorg.lwjgl.librarypath를 설정하십시오. ' – javac
고마워, 이것에 대해 읽어 볼게. – Bort