Search code examples
javagraphicsjarlwjglslick2d

LWJGL Package is sealed


I'm following along with a youtube tutorial on programming in Java using Slick2D and lwjgl. When I run this code:

package game;
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 name) {
    super(name);
    this.addState(new Menu(menu));
    this.addState(new Play(play));
}

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

}

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

}

}

It throws a security exception saying that the package org.lwjgl is sealed. I've added the lwjgl jar file and the two jar files associated with slick (slick2d and lwjgl . jar) to the build path. Is there a solution?


Solution

  • I had the same problem ones. And I Found that going into the Jar file(s) and opening up the Manifest file, and then removing the

    Sealed: true
    

    line entirely fixed my problem. And just so you know there would be no need to re package or something if you open the jar file with e.g. Winrar and then editing the file while it is in the jar.

    You probably only need to go into the lwjgl jar files.

    Hope it works out for you!