gpt4 book ai didi

java - JSON-lib NoClassDefFoundError org.apache.commons.lang.exception.NestableRuntimeException

转载 作者:行者123 更新时间:2023-11-30 00:57:02 27 4
gpt4 key购买 nike

我正在尝试从我网站上的 MySql 数据库检索一些数据。具体来说,我正在制作一个游戏(使用 LibGDX 框架),并希望从数据库中检索前 10 个高分。这是我处理 JSON 数据的代码部分

    JSONArray jArray = new JSONArray();
jArray.add(result);
for (int i = 0; i < jArray.size(); i++) {
JSONObject jsonData = (JSONObject) jArray.get(i);
System.out.printf("Name:%s \t Score: %d \n",
jsonData.getString("name"), jsonData.getInt("score"));
}

这是代码运行时出现的错误

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.me.gdxshooter.HighScores.readDatabase(HighScores.java:58)
at com.me.gdxshooter.GameInstance.update(GameInstance.java:109)
at com.me.gdxshooter.GameScreen.render(GameScreen.java:29)
at com.badlogic.gdx.Game.render(Game.java:46)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:207)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 18 more

这是我的项目的类路径中所有 jar 的屏幕截图。 http://imgur.com/LYDisA3任何帮助,将不胜感激!

最佳答案

试试这个:

转到项目/属性/Java 构建路径/顺序和导出 - 如果使用 Android 依赖项和支持库,请确保选中它。标记所有复选框,然后单击“应用”并清理项目。

希望这有帮助。

关于java - JSON-lib NoClassDefFoundError org.apache.commons.lang.exception.NestableRuntimeException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20461254/

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