Applet with lwjgl & slick

Hey am trying to learn how applets work with lwjgl & slick, but i can’t seem to get it working… Here are the steps i take -

  • Export Game as “JAR file”
  • get - slick.jar, lwjgl.jar, natives-win.jar & lwjgl_util_applet.jar… i put it on my desk top
  • then i create a html file (notepad) the put the code it it.

this is the code i have in my html file -

`

Applet Test

`

my game code -

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

public class Display extends BasicGame {
	public static void main(String[] args){
		try{
		AppGameContainer app = new AppGameContainer(new Display());
		app.setDisplayMode(800, 600, false);
		app.start();
		}catch (SlickException e){ e.printStackTrace(); }
	}

	public Display() {
		super("Applet Game");
	}

	@Override
	public void render(GameContainer gc, Graphics g) throws SlickException {
		g.setColor(Color.white);
		g.fillOval(150, 150, 50, 50, 5);
	}

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

	}

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

	}

}

Error ‘extracting downloaded packages’
Am not using any images in my code just appGameContainer using the Graphics to create an filloval

Cheers for taking a look :slight_smile:

Post the output from the Java Console as the exception on there should explain why its failing on extracting the downloaded packages. If you haven’t already, you’ll have to enable to the Java Console from the Java Control Panel for it to show up when you run the applet in the browser.

This occurred while ‘Extracting downloaded packages’
error in opening zip file
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(Unknown Source)
at java.util.zip.ZipFile.(Unknown Source)
at java.util.jar.JarFile.(Unknown Source)
at java.util.jar.JarFile.(Unknown Source)
at org.lwjgl.util.applet.AppletLoader.extractNatives(AppletLoader.java:1789)
at org.lwjgl.util.applet.AppletLoader.run(AppletLoader.java:877)
at java.lang.Thread.run(Unknown Source)

Which version of LWJGL are you using? If not already using, please try with the latest LWJGL 2.8.4 release (especially the latest lwjgl_util_applet.jar).

am using the lastest version of lwjgl, just double checked there by download them… still the same error :frowning:

have you got the applet uploaded somewhere that you can share? (do please also include linux natives).

I got it working, i think it was because i never took lwjgl.jar & lwjgl_util_applet.jar out of the applet version :P… finally got it working only took 2 days ::slight_smile:

Thanks for your help really appreciate it :slight_smile: