java.lang.NoClassDefFoundError:org/lwjgl/LWJGLException [英] java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
问题描述
尝试在学校玩游戏时,尝试使用Eclipse运行时,我不断收到"java.lang.NoClassDefFoundError:org/lwjgl/LWJGLException".有任何想法吗?这是我的代码
Trying to work on a game for school and I keep getting a "java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException" when trying to run using eclipse. Any ideas? Here is my code
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
还有我得到的全部错误.
And the full error I am getting.
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
And I'm pretty sure I have this set correct. http://i.imgur.com/YD77T2C.png
推荐答案
我已经弄清楚了,因此我将其发布,以防其他有相同问题的人偶然发现此页面.我必须使用旧版本的lwjgl.jar,该版本2.9.3是从旧的lwjgl网站 http://legacy.com上使用的.lwjgl.org/.
I figured it out so I will post it in case anyone else having the same problem stumbles upon this page. I had to use an older version of lwjgl.jar, version 2.9.3 worked from the old lwjgl website http://legacy.lwjgl.org/ .
这篇关于java.lang.NoClassDefFoundError:org/lwjgl/LWJGLException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!