Search code examples
javajarlwjglslick2d

run time error in java slick2D project while using AppGameContainer


Hi I am trying to make a java game using slick2D and lwjgl 2.8.4. But I am not being able to implement AppGameContainer class. It causes a run time error. My code is given below:

  import org.newdawn.slick.AppGameContainer;
  import org.newdawn.slick.BasicGame;
  import org.newdawn.slick.GameContainer;
  import org.newdawn.slick.Graphics;
  import org.newdawn.slick.SlickException;


  public class Main extends BasicGame{

   public Main(String title) {
    super(title);
    // TODO Auto-generated constructor stub
   }




   public static void main(String args[]) throws SlickException{
    AppGameContainer app = new AppGameContainer(new Main("Tower Defence"));
    app.setDisplayMode(800, 600, false);
        app.start();

   }

   @Override
   public void render(GameContainer container, Graphics g)
        throws SlickException {
    // TODO Auto-generated method stub

   }

   @Override
   public void init(GameContainer container) throws SlickException {
    // TODO Auto-generated method stub

   }

   @Override
   public void update(GameContainer container, int delta)
        throws SlickException {
    // TODO Auto-generated method stub

   }

  }

Then I get the following run time error: enter image description here

my package explorer in eclipse is given below:

enter image description here

How can I avoid this error?


Solution

  • The graphics card driver was not installed. Installation of the graphics card driver solved the problem.