Errors while trying to use Slick Applet

Okay, so I’m trying to run this code as a applet.


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 Test extends BasicGame {
	public Test() {
		super("Image Test");
	}
	
	public void init(GameContainer container) throws SlickException {
		
	}

	public void render(GameContainer container, Graphics g) {
		g.setColor(Color.red);
		g.fillRect(0,0,640,480);
	}

	public void update(GameContainer container, int delta) {

	}
	
	public static void main(String[] argv) {
		try{
			AppGameContainer container = new AppGameContainer(new Test());
			container.setDisplayMode(640,480,false);
			container.start();
		}
		catch(SlickException e){
			
		}
	}

	public void keyPressed(int key, char c) {

	}
}

And I got these files in my folder

and this is my HTML file:


<applet code="org.lwjgl.util.applet.AppletLoader" 
        archive="lwjgl_util_applet.jar, lzma.jar" 
        codebase="." 
        width="640" height="480">
 
  <param name="al_title" value="Applet Test"> 
  <param name="al_main" value="org.newdawn.slick.AppletGameContainer"> 
  <param name="game" value="Test">  
 
  <param name="al_logo" value="appletlogo.png"> 
  <param name="al_progressbar" value="appletprogress.gif"> 
 
  <param name="al_jars" value="test.jar, lwjgl.jar, slick.jar"> 
 
  <param name="al_windows" value="windows_natives.jar"> 
  <param name="al_linux" value="linux_natives.jar"> 
  <param name="al_mac" value="macosx_natives.jar"> 
 
  <param name="separate_jvm" value="true"> 
</applet> 

getting this error:


Java Plug-in 1.6.0_21
Using JRE version 1.6.0_21-b07 Java HotSpot(TM) Client VM
User home directory = C:\Users\cyanprime

----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@1a1c887
basic: Plugin2ClassLoader.addURL parent called for file:/H:/applettest/lwjgl_util_applet.jar
basic: Plugin2ClassLoader.addURL parent called for file:/H:/applettest/lzma.jar
network: Cache entry not found [url: file:/H:/applettest/lwjgl_util_applet.jar, version: null]
security: Accessing keys and certificate in Mozilla user profile: null
security: Loading Root CA certificates from C:\Program Files (x86)\Java\jre6\lib\security\cacerts
security: Loaded Root CA certificates from C:\Program Files (x86)\Java\jre6\lib\security\cacerts
security: Loading Deployment certificates from C:\Users\cyanprime\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs
security: Loaded Deployment certificates from C:\Users\cyanprime\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Start to check whether root CA is replaced
security: The root CA has been replaced
security: No timestamping info available
security: Found jurisdiction list file
security: Start checking trusted extension for this certificate
security: Start comparing to jurisdiction list with this certificate
security: The CRL support is disabled
security: The OCSP support is disabled
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
network: Cache entry not found [url: file:/H:/applettest/lwjgl_util_applet.jar, version: null]
network: Cache entry not found [url: file:/H:/applettest/lwjgl_util_applet.jar, version: null]
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Start to check whether root CA is replaced
security: The root CA has been replaced
security: No timestamping info available
security: Found jurisdiction list file
security: Start checking trusted extension for this certificate
security: Start comparing to jurisdiction list with this certificate
security: The CRL support is disabled
security: The OCSP support is disabled
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
network: Cache entry not found [url: file:/H:/applettest/lwjgl_util_applet.jar, version: null]
basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 559690 us, pluginInit dt 1291987 us, TotalTime: 1851677 us
Loaded image: jar:file:/H:/applettest/lwjgl_util_applet.jar!/appletlogo.png
Loaded image: jar:file:/H:/applettest/lwjgl_util_applet.jar!/appletprogress.gif
network: Cache entry not found [url: file:/H:/applettest/lzma.jar, version: null]
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Start to check whether root CA is replaced
security: The root CA has been replaced
security: No timestamping info available
security: Found jurisdiction list file
security: Start checking trusted extension for this certificate
security: Start comparing to jurisdiction list with this certificate
security: The CRL support is disabled
security: The OCSP support is disabled
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
basic: Loading Java Applet ...
network: Cache entry not found [url: file:/H:/applettest/lzma.jar, version: null]
network: Cache entry not found [url: file:/H:/applettest/lzma.jar, version: null]
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Start to check whether root CA is replaced
security: The root CA has been replaced
security: No timestamping info available
security: Found jurisdiction list file
security: Start checking trusted extension for this certificate
security: Start comparing to jurisdiction list with this certificate
security: The CRL support is disabled
security: The OCSP support is disabled
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
network: Cache entry not found [url: file:/H:/applettest/lzma.jar, version: null]
basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms
basic: Applet initialized
basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@1a1c887
basic: Applet made visible
basic: Starting applet
basic: completed perf rollup
basic: Applet started
basic: Told clients applet is started
This occurred while 'Downloading packages'
java.lang.Exception: Unable to get input stream for lwjgl.jar
	at org.lwjgl.util.applet.AppletLoader.getJarInputStream(AppletLoader.java:1172)
	at org.lwjgl.util.applet.AppletLoader.downloadJars(AppletLoader.java:1062)
	at org.lwjgl.util.applet.AppletLoader.run(AppletLoader.java:729)
	at java.lang.Thread.run(Unknown Source)


Does it being difficult to figure out make it suck? At any rate, it isn’t nice to criticize, and certainly not without contributing or even theorizing improvements. Criticism isn’t conducive to your getting help.

It looks you are having trouble with the LWJGL applet loader, not Slick. You might try making the LWJGL applet example work and get more complicated from there.

Okay, Slick shouldn’t make it so damn hard to figure out it’s applet system. Everything else in the lib is easy and fantastic, so wtf happened to this?

Reading documentation should help clear it up for you otherwise its pretty difficult since you don’t know what your doing.

see this tutorial as a basic intro to slick applets.

and also this tutorial to learn everything about lwjgl’s appletloader which slick applets use.

hope that helps.

Well, it is open source, so contribute a fix. My guess by that time you’ll understand why it is whatever pain in the ass it is.

Scar can package up applets and JWS for you.

oh and as for your error as to why its not working its pretty simple, you have no lwjgl.jar in the folder (you ask for it in your html, its explained by your pasted exception and seen to be missing in your screenshot).

CyanPrime before running a LWJGL applet, it might be better to first get a webstart version working. so you understand the basics of signing jars. then when you move to an applet, Im sure there will be less head aches.

It also means that you could have a working version up sooner to show off to other people.

but wait, should’t it load lwjgl.jar.lzma, as it has lzma.jar included?

if you want that to be the case then you must specify lwjgl.jar.lzma in the html rather then lwjgl.jar.

Also you’d probably want to use lwjgl.jar.pack.lzma instead if your want to go down that route as it will be smaller.

By including the lzma.jar in the archive path It doesnt have to use lzma compressed files, it just adds support for lzma if its needed, in this case the lzma.jar isnt required in the archive path.

But having the lzma.jar in the archive path wouldnt be causing the exception to be thrown.

To show off Scar:

To sign, normalize, pack, and lzma your JARs and generate a working applet.html file:


keystore("keystore", "alias", "pass", "Company", "Title");
lwjglApplet(project, "keystore", "alias", "pass");

To sign and optionally pack+gzip your JARs and generate a working JNLP file:


keystore("keystore", "alias", "pass", "Company", "Title");
jws(project, false, "keystore", "alias", "pass");
jnlp(project, "http://example.com/path/someapp.jnlp", "Company", "Title", "splash.png");

Why do it manually anymore? :slight_smile: For my applet, I use Scar once, then customize the HTML.

While I’m showing off, to upload my applet via FTP:


Paths paths = new Paths(project.format("{target}/applet-lwjgl"));
FTP.upload("example.com", "user", "pass", "/httpdocs/path", paths, false);

Okay, I’ve switched to Linux Mint and I’m still getting a error after remaking, and resigning the jar file in linux. I now have all the files from “slick/lib” this includes lwjgl.jar

this is my new error:
http://pastebin.ca/1947651

Is your JAR signed?

yup that error means lwjgl.jar is not signed.

cyanprime, your using the lwjgl 2.5 applet package, I presume you just grabbed the unsigned lwjgl.jar from somewhere else and included. What you should do if you don’t want to sign yourself is change in your html “lwjgl.jar” to “lwjgl.jar.pack.lzma” and use that from the lwjgl 2.5 applet package as that one is already signed.

That did it. I changed:

<param name="al_jars" value="test.jar, lwjgl.jar, slick.jar"> 

to

<param name="al_jars" value="test.jar, lwjgl.jar.pack.lzma, slick.jar"> 

Yup, Slick applets don’t suck. I’m just retarded.

Edit: changed title of first post cause I don’t need hype anymore.

You’re not creating “hype,” you’re creating “angst.” And you are continuing to lose the respect of people on this forum.

To clarify: everyone makes mistakes. But not everyone blames their mistakes on someone else. And even if you were totally convinced it was someone else’s fault, there is no reason to be disrespectful about it.

Whatever works. This works though. Notice how much faster I got a reply than my other thread where I didn’t create hype: http://www.java-gaming.org/index.php/topic,22986.0.html

Eli is right, your probably more likely to get a better response from people if you ask politely and not criticise their work.

The only reason your other thread didn’t was because the answer was already in this thread and you had created it needlessly.

How do I use AppletGameContainer?
« on: September 22, 2010, 05:54:54 pm »

Errors while trying to use Slick Applet
« on: September 22, 2010, 07:46:19 pm »

As you can see, I created the AppletGameContainer thread first, by 2 hours. I figured out the answer myself because I didn’t get any replies, than I made this thread.

hum, fair enough :slight_smile: