【问题标题】:java.lang.NoClassDefFoundError: org/lwjgl/LWJGLExceptionjava.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
【发布时间】:2015-06-02 18:18:39
【问题描述】:

尝试为学校开发游戏,但在尝试使用 Eclipse 运行时,我不断收到“java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException”。有任何想法吗?这是我的代码

package javagame;
import org.newdawn.slick.*;
import org.newdawn.slick.state.*;


public class Game extends StateBasedGame{

private static final String GAME_NAME = "TEST";
private static final int MENU = 0;
private static final int PLAY = 1;

public Game(String GAME_NAME){
    super(GAME_NAME);
    this.addState(new Menu(MENU));
    this.addState(new Play(PLAY));
}// end constructor

public void initStatesList(GameContainer gc) throws SlickException{
    this.getState(MENU).init(gc, this);
    this.getState(PLAY).init(gc, this);
    this.enterState(MENU);
}//end initStateList method

public static void main(String[] args) {
    AppGameContainer appgc;
    try{
        appgc = new AppGameContainer(new Game(GAME_NAME));
        appgc.setDisplayMode(640, 360, false);
        appgc.start();
    }//end try
    catch(SlickException e){
        e.printStackTrace();
    }//end catch

}//end main method

}//end Game class

我得到的完整错误。

Exception in thread "main" java.lang.NoClassDefFoundError:    org/lwjgl/LWJGLException
at javagame.Game.main(Game.java:27)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
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)
... 1 more

而且我很确定我的设置是正确的。 http://i.imgur.com/YD77T2C.png

【问题讨论】:

  • 是'Order and Export'选项卡中导出的lwjgl jar吗?
  • 不确定您要问什么,但这是我的“订单和导出”标签i.imgur.com/nCaBAmG.png
  • 你设置了合适的本地人吗?
  • 在我发帖之前,我找到了那个页面并尝试了上面的所有内容,抱歉我应该这么说。当我在 Windows 机器上运行时,我确实设置了 Windows 本机。

标签: java lwjgl noclassdeffounderror classnotfoundexception slick2d


【解决方案1】:

我想通了,所以我会发布它,以防其他有同样问题的人偶然发现这个页面。我不得不使用旧版本的 lwjgl.jar,2.9.3 版从旧的 lwjgl 网站 http://legacy.lwjgl.org/ 工作。

【讨论】:

  • 我仍然很好奇为什么它一开始就不起作用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多