Search code examples
javaminecraft

Running Minecraft. [LWJGL] Failed to load a library


I'm developing my own Minecraft launcher in Rust. Now I have problems with running it.

I use this command to run Minecraft:

java -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Dos.name=Windows 10 -Dos.version=10.0 -Xss1M -Djava.library.path=E:\\programming\\code\\nomi\\nomi_core\\minecraft\\versions\\1.18.2\\natives -Dminecraft.launcher.brand=nomi -Dminecraft.launcher.version=0.0.1 -cp classpath_here net.minecraft.client.main.Main --username Name --version 1.18.2 --gameDir Path/to/game/dir --assetsDir Path/to/assets/dir --assetIndex 1.18 --uuid null --accessToken null unknow_params(below) --versionType release

I don't know what these params do (I ignore them in my command):

--clientId ${clientid} --xuid ${auth_xuid} --userType ${user_type}

And I'm getting this error:

[16:03:53] [main/WARN]: Unrecognized user type: ${user_type}
[16:03:53] [Render thread/INFO]: [STDERR]: [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.
[16:03:53] [Render thread/INFO]: [STDERR]: [LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[16:03:53] [Render thread/INFO]: [STDERR]: [LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
Exception in thread "Render thread" [16:03:53] [Render thread/INFO]: [STDERR]: java.lang.NoClassDefFoundError: Could not initialize class com.mojang.blaze3d.systems.RenderSystem
[16:03:54] [Render thread/INFO]: [STDERR]:      at ac.a(SourceFile:65)
[16:03:54] [Render thread/INFO]: [STDERR]:      at dyr.a(SourceFile:2394)
[16:03:54] [Render thread/INFO]: [STDERR]:      at dyr.a(SourceFile:2389)
[16:03:54] [Render thread/INFO]: [STDERR]:      at net.minecraft.client.main.Main.main(SourceFile:206)
[16:03:54] [Render thread/INFO]: [STDERR]: Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: Failed to locate 
library: lwjgl.dll [in thread "Render thread"]
[16:03:54] [Render thread/INFO]: [STDERR]:      at org.lwjgl.system.Library.loadSystem(Library.java:147)
[16:03:54] [Render thread/INFO]: [STDERR]:      at org.lwjgl.system.Library.loadSystem(Library.java:67)
[16:03:54] [Render thread/INFO]: [STDERR]:      at org.lwjgl.system.Library.<clinit>(Library.java:50)
[16:03:54] [Render thread/INFO]: [STDERR]:      at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:97)
[16:03:54] [Render thread/INFO]: [STDERR]:      at dsk.<clinit>(SourceFile:8)
[16:03:54] [Render thread/INFO]: [STDERR]:      at dth.<init>(SourceFile:56)
[16:03:54] [Render thread/INFO]: [STDERR]:      at dto.<init>(SourceFile:19)
[16:03:54] [Render thread/INFO]: [STDERR]:      at dto.<init>(SourceFile:23)
[16:03:54] [Render thread/INFO]: [STDERR]:      at dto.<clinit>(SourceFile:11)
[16:03:54] [Render thread/INFO]: [STDERR]:      at com.mojang.blaze3d.systems.RenderSystem.<clinit>(SourceFile:46)
[16:03:54] [Render thread/INFO]: [STDERR]:      at net.minecraft.client.main.Main.main(SourceFile:194)

I have java 17.0.7 java --version output:

openjdk 17.0.7 2023-04-18
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)

I have no idea how to fix it but Minecraft must launch


Solution

  • Solution:

    1. Download natives libs for LWJGL. They are in the classifiers section in the version manifest
    2. Add them to classpath