Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Deployment with applets and slick2d  (Read 1601 times)
0 Members and 1 Guest are viewing this topic.
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Posted 2012-07-14 22:44:32 »

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 Cheesy

Offline ra4king

JGO Kernel


Medals: 345
Projects: 2
Exp: 5 years


I'm the King!


« Reply #1 - Posted 2012-07-14 23:21:15 »

I'm getting this exception:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
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)

Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #2 - Posted 2012-07-14 23:59:50 »

I'm getting this exception:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
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:
1  
2  
3  
4  
5  
6  
7  
// 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.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ra4king

JGO Kernel


Medals: 345
Projects: 2
Exp: 5 years


I'm the King!


« Reply #3 - Posted 2012-07-15 00:03:06 »

How are you using LWJGL without signing anyway? O_o

Also, try removing the forward slash.

Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #4 - Posted 2012-07-15 06:27:35 »

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.

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 77
Projects: 15


★★★★★


« Reply #5 - Posted 2012-07-15 11:42:28 »

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.
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #6 - Posted 2012-07-15 18:45:37 »

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, f**k 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.

Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #7 - Posted 2012-07-15 18:51:17 »

I added linux natives now, thanks for spotting!  Smiley

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 77
Projects: 15


★★★★★


« Reply #8 - Posted 2012-07-15 19:30:32 »

try without the leading slash

String fontPath = "res/font/calibri.ttf";
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #9 - Posted 2012-07-15 19:48:05 »

try without the leading slash

String fontPath = "res/font/calibri.ttf";

Well it works! Thank you very much.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 77
Projects: 15


★★★★★


« Reply #10 - Posted 2012-07-15 22:15:59 »

Glad you got it to work, good job.

I added linux natives now, thanks for spotting!  Smiley
Still doesn't work, according to the html code the linux natives should be here, but file doesn't exist.
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #11 - Posted 2012-07-15 23:04:47 »

Glad you got it to work, good job.

I added linux natives now, thanks for spotting!  Smiley
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!  Smiley

Offline ra4king

JGO Kernel


Medals: 345
Projects: 2
Exp: 5 years


I'm the King!


« Reply #12 - Posted 2012-07-16 03:40:34 »

Also, try removing the forward slash.
Pointing

Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #13 - Posted 2012-07-16 12:21:52 »


At the time, it didn't work. There was a few other problems underway  Cranky

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (13 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

atombrot (38 views)
2014-08-19 09:29:53

Tekkerue (32 views)
2014-08-16 06:45:27

Tekkerue (32 views)
2014-08-16 06:22:17

Tekkerue (19 views)
2014-08-16 06:20:21

Tekkerue (29 views)
2014-08-16 06:12:11

Rayexar (66 views)
2014-08-11 02:49:23

BurntPizza (42 views)
2014-08-09 21:09:32

BurntPizza (34 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!