Deployment with applets and slick2d

I hear you whine! Stop.

I am having trouble deploying this: http://www.javadaemon.com/games/regnorm/index.html

It’s quite odd, since I deployed this: http://www.javadaemon.com/games/skrollr/index.html, and this: http://www.javadaemon.com/games/breakout/index.html without errors. The setups should be the same, but feel free to check.’

This is driving me nuts.

Cookies if you find the error :smiley:

I’m getting this exception:



java.security.AccessControlException: access denied ("java.io.FilePermission" ".\res\font\Calibri.ttf" "read")
	at java.security.AccessControlContext.checkPermission(Unknown Source)
	at java.security.AccessController.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkRead(Unknown Source)
	at java.io.File.exists(Unknown Source)
	at org.newdawn.slick.util.FileSystemLocation.getResourceAsStream(FileSystemLocation.java:52)
	at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:61)
	at org.newdawn.slick.UnicodeFont.createFont(UnicodeFont.java:61)
	at org.newdawn.slick.UnicodeFont.<init>(UnicodeFont.java:173)
	at com.javadaemon.regnorm.Regnorm.init(Regnorm.java:54)
	at org.newdawn.slick.AppletGameContainer$Container.initApplet(AppletGameContainer.java:272)
	at org.newdawn.slick.AppletGameContainer$ContainerPanel.initGL(AppletGameContainer.java:229)
	at org.newdawn.slick.AppletGameContainer$ContainerPanel.start(AppletGameContainer.java:216)
	at org.newdawn.slick.AppletGameContainer$1.run(AppletGameContainer.java:92)

So am I. The problem is that I can’t let Slick do that loading, since the UnicodeFont format requires fonts to be loaded like this:


// Load fonts
		String fontPath = "/res/font/calibri.ttf";
		fpsFont = new UnicodeFont(fontPath, 15, true, false);
		fpsFont.addAsciiGlyphs();   // Add Glyphs
		fpsFont.addGlyphs(400, 600); // Add Glyphs
		fpsFont.getEffects().add(new ColorEffect(java.awt.Color.WHITE)); // Add Effects
		fpsFont.loadGlyphs();  // Load Glyphs

I don’t see a way I can get to do this without signing, even though I believe I should be able to.

How are you using LWJGL without signing anyway? O_o

Also, try removing the forward slash.

I didn’t sign anything personally, because LWJGL is signed by default.
I’ve tried with and without the forward slash - none worked.

I figured it’s because of the way its loaded - Font is a java class, and it’s Font that loads the file off the filesystem - not Slick.
Under that logic it’s impossible to use any fonts in applets though, which I can’t believe.

Applet didn’t work for me here on linux since lwjgl_natives.jar wasn’t found.

Anyway its a pretty simple problem, you can’t read files from the file system when using applet, they have to be in the jars.

regnorm.jar does not contain “res\font\Calibri.ttf” hence it can’t load it and fails after slick has checked the jar and then falls back to trying to look for it on the file system. You need to have that font file in your jar.

also I noticed that regnorm.jar oddly also contains both lwjgl.jar and slick.jar inside it, thats an extra 1.3mb that your applet doesn’t need to function.

Well, fuck me! Sorry for my french, too. Let’s hope the filter will catch that one.

I swear I had it. I’m going to rebuild that, and report back. I also don’t know where I can get those. I usually just use Eclipse if I need to .jar something. Will the commandline work, with the linux natives provided in the official download?

I’ve now reuploaded too, and it still doesn’t work. The error is the same though. Thanks for spotting, however.

I added linux natives now, thanks for spotting! :slight_smile:

try without the leading slash

String fontPath = “res/font/calibri.ttf”;

Well it works! Thank you very much.

Glad you got it to work, good job.

Still doesn’t work, according to the html code the linux natives should be here, but file doesn’t exist.

Oh. I added it now. It was a messy-server error. I manage the website by what feels worse than command-line.

Cheers! :slight_smile:

:point:

At the time, it didn’t work. There was a few other problems underway :cranky: