Daprofeta
Daprofeta

Reputation: 21

ERROR!! AppGameContainer java.lang.ClassNotFoundException

this is my code:

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

public class Game extends StateBasedGame{

    public static final String gamename = "Ham Blaster!";
    public static final int menu = 0;
    public static final int play = 1;

    public Game(String gamename) {
        super(gamename);
        this.addState(new Menu(menu));
        this.addState(new Play(play));
    }

    public void initStatesList(GameContainer gc) throws SlickException{
        this.getState(menu).init(gc, this);
        this.getState(play).init(gc, this);
        this.enterState(menu);
    }

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

}

And this is the error that its get me:

exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
    at JavaGame.Game.main(Game.java:28)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 1 more

so it got me the class no found error and i tried to add the jar again but it still give me the error. so please help me with this i check the library and it told me that the class is there but not the source.

this the screenshot with the lib folder:

screenshot

Upvotes: 2

Views: 1211

Answers (1)

Alfred Ayi-bonte
Alfred Ayi-bonte

Reputation: 775

Download an older version of lwjgl.jar, version 2.9.3 from the old lwjgl website http://legacy.lwjgl.org/

Upvotes: 1

Related Questions