gpt4 book ai didi

java - Libgdx 不适用于 Fedora 31 - 无法初始化类 org.lwjgl.Sys

转载 作者:行者123 更新时间:2023-12-03 04:09:22 26 4
gpt4 key购买 nike

我从官方网站下载了 libgdx(所以我想它是最新的),然后在 Intellij 中通过 gradle 打开它。我没有更改任何代码并编译了默认代码。这是我的构建配置:

enter image description here

应用程序无法运行,我收到此消息:

Exception in thread "LWJGL Application" java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.Sys
at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setVSync(LwjglGraphics.java:592)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)

我正在使用 Fedora 31 和 GNOME 3.34.5。您知道如何解决吗?

编辑:我试过另一种方式:从 libgdx 的 github 克隆代码并按照他们的 wiki 中的说明进行操作:

Native binaries must be brought down in order to run. These binaries are built on the snapshot build server, so you need to run a task to bring them down. Even if you plan on building natives later yourself, its recommended to bring these down so you can test your development environment is setup before moving to the next step. From the LibGDX root directory Through Gradle:

./gradlew fetchNatives


After running this I received:

FAILURE: Build failed with an exception.

What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

最佳答案

我没有声誉,所以我无法编辑或发表评论,但经过一些小调整后,我能够让 alekseymishanin 的解决方案发挥作用。

背景信息:Ubuntu 20.04,当我从 JDK 8 切换到 16 时,示例 libGDX 无法构建。

修复

  1. 将 gradle wrapper 升级到 7.0。你可能已经这样做了,因为如果没有这个修复,你会得到一个编译时错误:./gradlew wrapper --gradle-version 7.0
  2. 通过将 api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" 替换为 api "com.badlogicgames.gdx:gdx-backend-"在 build.gradle 中切换到 lwgl3 lwjgl3:$gdxVersion"
  3. DesktopLauncher.java 中,相应地更新导入,并将 Lwjgl 的所有实例替换为 Lwjgl3。例如,new LwjglApplicationConfiguration() 变为 new Lwjgl3ApplicationConfiguration()

关于java - Libgdx 不适用于 Fedora 31 - 无法初始化类 org.lwjgl.Sys,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61994433/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com