2

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

LW001
  • 2,452
  • 6
  • 27
  • 36
Daprofeta
  • 21
  • 4
  • Could you show the screenshot of your /lib folder? Did you add the jar to your Build Path? Here is how-to: http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-%28Java%29 – display name Dec 03 '14 at 00:22
  • 1
    That looks like you don't have the LWJGL jar in your classpath *at runtime* – Gus Dec 04 '14 at 23:01

1 Answers1

1

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

Alfred Ayi-bonte
  • 715
  • 7
  • 11