LibGDX project created using the tool giving errors
See original GitHub issuePlease ensure you have given all the following requested information in your report.
Issue details
When I run my project, I get this error telling me its failed to load a library:
I also downloaded Lwjgl and added all the class files to my project structure but it still did not fix this When I added the lwjgl to libraries this is how it added: (some more below, the screenshot is cut off)
Reproduction steps/code
Even if you think your issue is trivial to reproduce, please supply a SSCCE that demonstrates your issue. This saves time on our end, and makes it much more likely that your issue will be fixed. You can find barebones templates here I created a libgdx project using the setup tool, selected only the desktop option, and selected all the extensions. the external libraries added
Version of libGDX and/or relevant dependencies
Please provide the version(s) affected. used the latest nightly release
Stacktrace
//Please provide the stacktrace if applicable
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.dylib
at org.lwjgl.system.Library.loadSystem(Library.java:162)
at org.lwjgl.system.Library.loadSystem(Library.java:62)
at org.lwjgl.system.Library.<clinit>(Library.java:50)
at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:97)
at org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:67)
at org.lwjgl.system.Callback.<clinit>(Callback.java:41)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.initializeGlfw(Lwjgl3Application.java:81)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:91)
at com.mygdx.game.DesktopLauncher.main(DesktopLauncher.java:12)
Please select the affected platforms
- Android
- iOS
- HTML/GWT
- Windows
- Linux
- macOS
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
M1 Macs aren’t supported by any stable release of libGDX yet, but they are pretty much supported by the current snapshot,
1.10.1-SNAPSHOT
. The beta version Frosty linked of gdx-liftoff should run correctly on an M1 Mac, even if you have an ARM64 JDK (the native type for your machine, instead of an x86_64 JDK, which would be emulated with Rosetta). If you give1.10.1-SNAPSHOT
as the version to gdx-liftoff, then the projects it generates should build and run on your Mac. You don’t need to self-build LWJGL 3.3.0 unless you’re making some changes to it. If you do need to change LWJGL 3.3.0, you can use the steps that gdx-liftoff itself follows (or followed) to ensure 3.3.0 was used even before libGDX used it: https://github.com/tommyettinger/gdx-liftoff/blob/24765d3728deba96a9dda361d414ab359927ef60/build.gradle#L60-L100 If yourlwjgl3Version
is defined ingradle.properties
as the custom name you have for your self-built version, it will use that self-built version.Yeah, those are fine. Eventually libGDX will update to Java 8 entirely, but for now, RoboVM only has partial Java 8 support. That means libGDX itself sticks to Java 7 internally, despite it producing those warnings on newer JDKs. If you don’t target iOS or rather-old Android versions, you can safely use Java 8, and if you only target desktop platforms (LWJGL3), then you can use as high as Java 17 with a gdx-liftoff project. If targeting desktop, the right way to distribute your game on Mac involves bundling a JRE with your game, which Packr or the built-in jpackage tools can do. If you bundle a JRE, then no one running your game has to know what Java they have installed (since you provide one).
But if you do target iOS, you should stick with version 7 until some future RoboVM update that gets Java 8 compatible with iOS. You can ignore the warnings unless years in the future, Java 7 is entirely removed and we for whatever reason need to use a much newer JDK version. Java 17 is LTS (long-term supported) by Oracle, so Java 7 will have to be supported as much as JDK 17 supports it now for at least 3 years.
This seems to be resolved now, so hooray! I’ll close this.