question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LibGDX project created using the tool giving errors

See original GitHub issue

Please 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: Screenshot 2021-12-10 at 12 02 18

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: Screenshot 2021-12-10 at 12 16 57 (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 Screenshot 2021-12-10 at 12 15 31 Screenshot 2021-12-10 at 12 15 46

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:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tommyettingercommented, Dec 10, 2021

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 give 1.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 your lwjgl3Version is defined in gradle.properties as the custom name you have for your self-built version, it will use that self-built version.

0reactions
tommyettingercommented, Dec 10, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LibGdx Tools Error - java - Stack Overflow
The issue with adding libgdx-tools to core project is that the libgdx-tools are not compatible with android/ios projects.
Read more >
Error when creating new project on gradle compile phase #5338
Hi! I have a gradle dependencies error when generating new project from LibGDX project generator. When i open the resulting project in IDE ......
Read more >
Getting Help - libGDX
The libGDX community is glad to help you when you get stuck or encounter a bug, but we need your help to make...
Read more >
LibGDX - Cornell Computer Science
This series from the website Games from Scratch is the most popular tutorial for creating LibGDX games. It is a wealth of examples...
Read more >
Getting to Know LibGDX - Packt Hub
We know by now that LibGDX is this awesome tool for creating games across many platforms with the ability to iterate on our...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found