Mads
|
 |
«
Posted
2011-11-21 04:20:31 » |
|
Hey guys! I know this one has been up before, but since the search function is crap... The rest you know. I want to deploy my application w/ slick2d as an applet. I followed the nice tutorial on NinjaCave and it all works fine. Except, my game is not signed, and it can therefore not reach my resources, which is in the same jar. So, either I change the way resources are loaded: 1 2
| tilesheet = new SpriteSheet("res/tileset.png", TILE_WIDTH, TILE_HEIGHT); background = new Image("res/background.png"); |
or, I sign the thing. After tons of looking around, it seems that signing is not exctly the easest thing in the world. It also seams that I need to register, and all kinds of legal things to do this, and I just can't believe that. So, what would be the easiest? Is there an easy way to sign my game, to gain acces? Is there an easy way to load resources, that I don't know of?
|
|
|
|
gbeebe
|
 |
«
Reply #1 - Posted
2011-11-21 04:30:39 » |
|
I hope someone comes along and says that Signing a jar isn't that hard and explains EXACTLY how to do it, 'cause yea, I don't get it either. Does this work? 1 2 3
| URL inMyJar = getClass().getResource("res/"); Image background; background = getImage(inMyJar, "background.png"); |
I don't use Slick2d (I'm assuming that's where the SpriteSheet() comes from) but perhaps there is a way to load an image and convert it to a SpriteSheet?
|
|
|
|
|
Mads
|
 |
«
Reply #2 - Posted
2011-11-21 05:02:37 » |
|
I hope someone comes along and says that Signing a jar isn't that hard and explains EXACTLY how to do it, 'cause yea, I don't get it either. Does this work? 1 2 3
| URL inMyJar = getClass().getResource("res/"); Image background; background = getImage(inMyJar, "background.png"); |
I don't use Slick2d (I'm assuming that's where the SpriteSheet() comes from) but perhaps there is a way to load an image and convert it to a SpriteSheet? I can't initialize an Image that way. It needs to have the string reference. http://slick.cokeandcode.com/javadoc/I've tried to create a keystore, and signing and verifying my game.jar , but I still get the permission-error, even when clicking yes in the permissions box. Even though I typed in all my information when prompted during signing it appears as UNKNOWN, and none of it is showed. 1 2 3
| keytool -genkey -alias madshorndrup -keystore madskeystore jarsigner -keystore madskeystore skrollr.jar madshorndrup jarsigner -verify skrollr.jar |
The whole process runs smoothly, and I looked to check I was getting the signature in the jars. EDIT: With signing, I still get this error: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| java.security.AccessControlException: access denied (java.io.FilePermission .\res\actors\spritesheet.png 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.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:169)8/ at org.newdawn.slick.Image.<init>(Image.java:196) at org.newdawn.slick.SpriteSheet.<init>(SpriteSheet.java:129) at org.newdawn.slick.SpriteSheet.<init>(SpriteSheet.java:115) at org.newdawn.slick.SpriteSheet.<init>(SpriteSheet.java:102) at com.javadaemon.skrollr.util.ResourceManager.initGraphics(ResourceManager.java:135) at com.javadaemon.skrollr.util.ResourceManager.init(ResourceManager.java:41) at com.javadaemon.skrollr.util.ResourceManager.<init>(ResourceManager.java:37) at com.javadaemon.skrollr.util.ResourceManager.getRessourceManager(ResourceManager.java:30) at com.javadaemon.skrollr.GameMain.init(GameMain.java:45) 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) |
|
|
|
|
Games published by our own members! Check 'em out!
|
|
ra4king
|
 |
«
Reply #3 - Posted
2011-11-21 06:45:27 » |
|
Maybe it's not accessing the right file. Try using a forward slash ('/') at the beginning of the path to signify the root of the jar. Also you do not need to sign a jar to be able to access resources inside it. However you do need to sign the jar to access files on the client's file system AND to be able to load native code (which you must do to use Slick2D/LWJGL).
|
|
|
|
pitbuller
|
 |
«
Reply #4 - Posted
2011-11-21 08:36:23 » |
|
Maybe it's not accessing the right file. Try using a forward slash ('/') at the beginning of the path to signify the root of the jar. Also you do not need to sign a jar to be able to access resources inside it. However you do need to sign the jar to access files on the client's file system AND to be able to load native code (which you must do to use Slick2D/LWJGL).
But lwjgl applet jar is allready signed and do not need own signing if those all only native files needed.
|
|
|
|
|
thaaks
|
 |
«
Reply #5 - Posted
2011-11-21 11:18:31 » |
|
I agree with pitbuller. Signing your own jars is not required. The LWJGL jars are signed and that's sufficient. It must be a different problem. My "StarCleaner" game runs as an applet and I didn't sign a single jar file. All resources (images, sheets, etc.) are inside my starcleaner.jar and it is a Slick game. And I also followed Kappa's tutorial on ninjacave to create Slick2D applets.
|
|
|
|
Mads
|
 |
«
Reply #6 - Posted
2011-11-21 14:04:19 » |
|
I agree with pitbuller. Signing your own jars is not required. The LWJGL jars are signed and that's sufficient. It must be a different problem. My "StarCleaner" game runs as an applet and I didn't sign a single jar file. All resources (images, sheets, etc.) are inside my starcleaner.jar and it is a Slick game. And I also followed Kappa's tutorial on ninjacave to create Slick2D applets.
How did you access the resources? Thanks for the replies guys. I will try to use the forward slash, and we will see where that goes.
|
|
|
|
princec
|
 |
«
Reply #7 - Posted
2011-11-21 14:28:55 » |
|
You are trying to load a resource as a file from the filesystem. Applets are not allowed to do this unless the entire codebase is signed with all permissions granted. You probably actually want to load your resource from one of the applet jars. Cas 
|
|
|
|
thaaks
|
 |
«
Reply #8 - Posted
2011-11-21 15:14:41 » |
|
I agree with pitbuller. Signing your own jars is not required. The LWJGL jars are signed and that's sufficient. It must be a different problem. My "StarCleaner" game runs as an applet and I didn't sign a single jar file. All resources (images, sheets, etc.) are inside my starcleaner.jar and it is a Slick game. And I also followed Kappa's tutorial on ninjacave to create Slick2D applets.
How did you access the resources? Thanks for the replies guys. I will try to use the forward slash, and we will see where that goes. StarCleaner relies on some ResourceManager we built as part of MarteEngine. But inside it uses the standard Slick constructors like new Image("relativeResourcepath"). No magic at all except what's happening inside Slick. All resources are part of the jar of course. If that's the case for you, something like this should work: 1
| Image background = new Image("res/background.png"); |
Feel free to browse our MarteEngine source code, the StarCleaner source code is also part of Marte (test/it/marteEngine/game/StarCleaner). Hope that helps a bit and cheers, Tommy
|
|
|
|
Mads
|
 |
«
Reply #9 - Posted
2011-11-21 23:05:15 » |
|
I agree with pitbuller. Signing your own jars is not required. The LWJGL jars are signed and that's sufficient. It must be a different problem. My "StarCleaner" game runs as an applet and I didn't sign a single jar file. All resources (images, sheets, etc.) are inside my starcleaner.jar and it is a Slick game. And I also followed Kappa's tutorial on ninjacave to create Slick2D applets.
How did you access the resources? Thanks for the replies guys. I will try to use the forward slash, and we will see where that goes. StarCleaner relies on some ResourceManager we built as part of MarteEngine. But inside it uses the standard Slick constructors like new Image("relativeResourcepath"). No magic at all except what's happening inside Slick. All resources are part of the jar of course. If that's the case for you, something like this should work: 1
| Image background = new Image("res/background.png"); |
Feel free to browse our MarteEngine source code, the StarCleaner source code is also part of Marte (test/it/marteEngine/game/StarCleaner). Hope that helps a bit and cheers, Tommy It looks like you did it with a stream some places, and with a filesystem others. I can't build your game though, so I can't check the "file" instance you initialize Images with.  You are trying to load a resource as a file from the filesystem. Applets are not allowed to do this unless the entire codebase is signed with all permissions granted. You probably actually want to load your resource from one of the applet jars. Cas  How would this be done? I only see Image can be initialized the following ways, in Slick: 1 2 3 4 5 6 7 8 9 10 11 12 13
| Image() Image(Image other) Image(ImageData data) Image(ImageData data, int f) Image(java.io.InputStream in, java.lang.String ref, boolean flipped) Image(java.io.InputStream in, java.lang.String ref, boolean flipped, int filter) Image(int width, int height) Image(java.lang.String ref) Image(java.lang.String ref, boolean flipped) Image(java.lang.String ref, boolean flipped, int filter) Image(java.lang.String ref, boolean flipped, int f, Color transparent) Image(java.lang.String ref, Color trans) Image(Texture texture) |
I cant even seem to get away with the input stream from class.getResourceAsStream(), nor the URL class.getResource()
|
|
|
|
Games published by our own members! Check 'em out!
|
|
princec
|
 |
«
Reply #10 - Posted
2011-11-21 23:27:42 » |
|
You need to use Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); Cas 
|
|
|
|
Mads
|
 |
«
Reply #11 - Posted
2011-11-21 23:35:43 » |
|
You need to use Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); Cas  That is still as a stream, and in Slick, I can't create the image from that 
|
|
|
|
ra4king
|
 |
«
Reply #12 - Posted
2011-11-22 00:42:47 » |
|
Isn't there a constructor that takes an InputStream? 
|
|
|
|
Mads
|
 |
«
Reply #13 - Posted
2011-11-22 00:45:39 » |
|
Isn't there a constructor that takes an InputStream?  I can't even get that constructor to work, because it also takes a string and a bool. 
|
|
|
|
ra4king
|
 |
«
Reply #14 - Posted
2011-11-22 00:55:27 » |
|
new Image(myInputStream, "path/to/file", false);
|
|
|
|
Mads
|
 |
«
Reply #15 - Posted
2011-11-22 01:56:26 » |
|
new Image(myInputStream, "path/to/file", false);
So you suggest a new InputStream()?
|
|
|
|
ra4king
|
 |
«
Reply #16 - Posted
2011-11-22 02:32:01 » |
|
No I'm suggesting you give it the same path you gave getResourceAsStream(String): 1 2
| String resource = "path/to/file"; new Image(Thread.currentThread().getContextClassLoader().getResourceAsStream(resource),resource,false); |
|
|
|
|
Mads
|
 |
«
Reply #17 - Posted
2011-11-22 03:12:00 » |
|
No I'm suggesting you give it the same path you gave getResourceAsStream(String): 1 2
| String resource = "path/to/file"; new Image(Thread.currentThread().getContextClassLoader().getResourceAsStream(resource),resource,false); |
1
| background = new Image(Thread.currentThread().getContextClassLoader().getResourceAsStream("/res/background.png"), "/res/background.png", false); |
Like this? It outputs these: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Mon Nov 21 20:11:04 CST 2011 ERROR:Stream closed java.io.IOException: Stream closed at java.io.BufferedInputStream.getInIfOpen(Unknown Source) at java.io.BufferedInputStream.available(Unknown Source) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:53) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43) at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:277) at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:231) at org.newdawn.slick.Image.load(Image.java:422) at org.newdawn.slick.Image.<init>(Image.java:269) at org.newdawn.slick.Image.<init>(Image.java:256) at com.javadaemon.skrollr.util.ResourceManager.initGraphics(ResourceManager.java:135) at com.javadaemon.skrollr.util.ResourceManager.init(ResourceManager.java:42) at com.javadaemon.skrollr.util.ResourceManager.<init>(ResourceManager.java:38) at com.javadaemon.skrollr.util.ResourceManager.getRessourceManager(ResourceManager.java:31) at com.javadaemon.skrollr.GameMain.init(GameMain.java:45) at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314) at com.javadaemon.skrollr.GameMain.main(GameMain.java:77) Mon Nov 21 20:11:04 CST 2011 ERROR:Failed to load image from: /res/tileset.png org.newdawn.slick.SlickException: Failed to load image from: /res/tileset.png at org.newdawn.slick.Image.load(Image.java:425) at org.newdawn.slick.Image.<init>(Image.java:269) at org.newdawn.slick.Image.<init>(Image.java:256) at com.javadaemon.skrollr.util.ResourceManager.initGraphics(ResourceManager.java:135) at com.javadaemon.skrollr.util.ResourceManager.init(ResourceManager.java:42) at com.javadaemon.skrollr.util.ResourceManager.<init>(ResourceManager.java:38) at com.javadaemon.skrollr.util.ResourceManager.getRessourceManager(ResourceManager.java:31) at com.javadaemon.skrollr.GameMain.init(GameMain.java:45) at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314) at com.javadaemon.skrollr.GameMain.main(GameMain.java:77) Caused by: java.io.IOException: Stream closed at java.io.BufferedInputStream.getInIfOpen(Unknown Source) at java.io.BufferedInputStream.available(Unknown Source) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:53) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43) at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:277) at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:231) at org.newdawn.slick.Image.load(Image.java:422) ... 10 more |
|
|
|
|
ra4king
|
 |
«
Reply #18 - Posted
2011-11-22 03:34:55 » |
|
Hmmm why was the stream closed?
|
|
|
|
Mads
|
 |
«
Reply #19 - Posted
2011-11-22 03:36:03 » |
|
Hmmm why was the stream closed?
This is what I'm doing: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| private void initGraphics() throws SlickException { Image tilesheet1 = new Image(Thread.currentThread().getContextClassLoader().getResourceAsStream("/res/tileset.png"), "/res/tileset.png", false); tilesheet = new SpriteSheet(tilesheet1, TILE_WIDTH, TILE_HEIGHT); Image charsheet1 = new Image(Thread.currentThread().getContextClassLoader().getResourceAsStream("/res/actors/spritesheet.png"), "/res/actors/spritesheet.png", false); charsheet = new SpriteSheet(tilesheet1, 16, 24); charAnimations = new HashMap<CHARANIM, Animation>(); for (CHARANIM animationEnum : CHARANIM.values()) { int numberOfFrames = animationEnum.frames.length; Image[] frames = new Image[numberOfFrames]; for (int i = 0; i < numberOfFrames; i++) { CHAR_IMAGE frameReference = animationEnum.frames[i]; frames[i] = charsheet.getSubImage(frameReference.getX(), frameReference.getY()) .getFlippedCopy(animationEnum.flipHorizontal, false); }
Animation animation = new Animation(frames, animationEnum.length); animation.setPingPong(animationEnum.pingpong); charAnimations.put(animationEnum, animation); } animationSets = new HashMap<ANIMATION_SET, AnimationSet>(); AnimationSet animSet = new AnimationSet(); animSet.addAnimation(DIRECTION.RIGHT.getID() | ANIMATION_STATE.STAND.getID(), CHARANIM.CHAR_STAND_RIGHT); animSet.addAnimation(DIRECTION.LEFT.getID() | ANIMATION_STATE.STAND.getID(), CHARANIM.CHAR_STAND_LEFT); animSet.addAnimation(DIRECTION.RIGHT.getID() | ANIMATION_STATE.WALK.getID(), CHARANIM.CHAR_WALK_RIGHT); animSet.addAnimation(DIRECTION.LEFT.getID() | ANIMATION_STATE.WALK.getID(), CHARANIM.CHAR_WALK_LEFT); animSet.addAnimation(DIRECTION.RIGHT.getID() | ANIMATION_STATE.JUMP.getID(), CHARANIM.CHAR_JUMP_RIGHT); animSet.addAnimation(DIRECTION.LEFT.getID() | ANIMATION_STATE.JUMP.getID(), CHARANIM.CHAR_JUMP_LEFT); animationSets.put(ANIMATION_SET.GRAY_GUY, animSet); background = new Image(Thread.currentThread().getContextClassLoader().getResourceAsStream("/res/background.png"), "/res/background.png", false); background.setFilter(Image.FILTER_NEAREST); } |
.and this is what happening: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| Mon Nov 21 20:35:52 CST 2011 INFO:Slick Build #274 Mon Nov 21 20:35:52 CST 2011 INFO:LWJGL Version: 2.7.1 Mon Nov 21 20:35:52 CST 2011 INFO:OriginalDisplayMode: 1366 x 768 x 32 @60Hz Mon Nov 21 20:35:52 CST 2011 INFO:TargetDisplayMode: 600 x 400 x 0 @0Hz Mon Nov 21 20:35:52 CST 2011 INFO:Starting display 600x400 Mon Nov 21 20:35:52 CST 2011 INFO:Use Java PNG Loader = true WARNING: Found unknown Windows version: Windows 7 Attempting to use default windows plug-in. Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin Mon Nov 21 20:35:52 CST 2011 INFO:Found 2 controllers Mon Nov 21 20:35:52 CST 2011 INFO:0 : Razer Mamba Mon Nov 21 20:35:52 CST 2011 INFO:1 : Razer Mamba Mon Nov 21 20:35:52 CST 2011 ERROR:Stream closed java.io.IOException: Stream closed at java.io.BufferedInputStream.getInIfOpen(Unknown Source) at java.io.BufferedInputStream.available(Unknown Source) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:53) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43) at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:277) at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:231) at org.newdawn.slick.Image.load(Image.java:422) at org.newdawn.slick.Image.<init>(Image.java:269) at org.newdawn.slick.Image.<init>(Image.java:256) at com.javadaemon.skrollr.util.ResourceManager.initGraphics(ResourceManager.java:135) at com.javadaemon.skrollr.util.ResourceManager.init(ResourceManager.java:42) at com.javadaemon.skrollr.util.ResourceManager.<init>(ResourceManager.java:38) at com.javadaemon.skrollr.util.ResourceManager.getRessourceManager(ResourceManager.java:31) at com.javadaemon.skrollr.GameMain.init(GameMain.java:45) at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314) at com.javadaemon.skrollr.GameMain.main(GameMain.java:77) Mon Nov 21 20:35:52 CST 2011 ERROR:Failed to load image from: /res/tileset.png org.newdawn.slick.SlickException: Failed to load image from: /res/tileset.png at org.newdawn.slick.Image.load(Image.java:425) at org.newdawn.slick.Image.<init>(Image.java:269) at org.newdawn.slick.Image.<init>(Image.java:256) at com.javadaemon.skrollr.util.ResourceManager.initGraphics(ResourceManager.java:135) at com.javadaemon.skrollr.util.ResourceManager.init(ResourceManager.java:42) at com.javadaemon.skrollr.util.ResourceManager.<init>(ResourceManager.java:38) at com.javadaemon.skrollr.util.ResourceManager.getRessourceManager(ResourceManager.java:31) at com.javadaemon.skrollr.GameMain.init(GameMain.java:45) at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314) at com.javadaemon.skrollr.GameMain.main(GameMain.java:77) Caused by: java.io.IOException: Stream closed at java.io.BufferedInputStream.getInIfOpen(Unknown Source) at java.io.BufferedInputStream.available(Unknown Source) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:53) at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43) at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:277) at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:231) at org.newdawn.slick.Image.load(Image.java:422) ... 10 more |
|
|
|
|
ra4king
|
 |
«
Reply #20 - Posted
2011-11-22 04:00:52 » |
|
Well I'm clueless as to why it is getting closed. The good thing is that getResourceAsStream(String) doesn't return null, which means the resource was found. Now this hiccup is quite puzzling :S
|
|
|
|
BoBear2681
|
 |
«
Reply #21 - Posted
2011-11-22 04:02:59 » |
|
BufferedInputStream will throw an IOException with message "Stream closed" if you pass it null as its constructor argument. Looks like under the covers, Slick is using BufferedInputStream, likely on the stream you pass it, so I'm still betting you're giving the wrong path to your resource and thus getting a null value for the stream.
|
|
|
|
|
Mads
|
 |
«
Reply #22 - Posted
2011-11-22 04:05:19 » |
|
BufferedInputStream will throw an IOException with message "Stream closed" if you pass it null as its constructor argument. Looks like under the covers, Slick is using BufferedInputStream, likely on the stream you pass it, so I'm still betting you're giving the wrong path to your resource.
Pretty sure I'm not. It works when initializing an image passing the same path. Tried both as applet, and in my environment. Neither works - they both close  anything I could try?
|
|
|
|
BoBear2681
|
 |
«
Reply #23 - Posted
2011-11-22 04:18:02 » |
|
Grab the Slick source and run in a debugger? BufferdInputStream.getInIfOpen() throws that Exception when the wrapped InputStream is null, so I'm still not convinced you're giving it the right path.  What is printed when you do this? 1
| System.out.println(Thread.currentThread().getContextClassLoader().getResourceAsStream("/res/tileset.png")); |
|
|
|
|
|
Mads
|
 |
«
Reply #24 - Posted
2011-11-22 04:35:23 » |
|
Grab the Slick source and run in a debugger? BufferdInputStream.getInIfOpen() throws that Exception when the wrapped InputStream is null, so I'm still not convinced you're giving it the right path.  What is printed when you do this? 1
| System.out.println(Thread.currentThread().getContextClassLoader().getResourceAsStream("/res/tileset.png")); |
Nothing is printed  This is getting a little.. meh.. Just checked out kevglass' Fizzy Bricks, and he loads 1
| this.cols[0] = new Image("res/blue.png"); |
and the file-system in his jar looks identical to mine. However, when I try to run something that just loads this one picture, using the way above, it still does not work 
|
|
|
|
gbeebe
|
 |
«
Reply #25 - Posted
2011-11-22 04:47:49 » |
|
Can you run Fizzy Bricks without an error?
[edit] and wouldn't the beginning "/" denote the root of the file system instead of the directory where the applet is?
|
|
|
|
|
Mads
|
 |
«
Reply #26 - Posted
2011-11-22 04:53:40 » |
|
Can you run Fizzy Bricks without an error?
[edit] and wouldn't the beginning "/" denote the root of the file system instead of the directory where the applet is?
Yes. Not my build though, but I can look inside whats going on. I tried both with and without the front slash - none work.
|
|
|
|
ra4king
|
 |
«
Reply #27 - Posted
2011-11-22 05:40:54 » |
|
If it was null, "null" would be printed. If it wasn't null, you would get java.io.InputStream@<hashcode>.
|
|
|
|
Mads
|
 |
«
Reply #28 - Posted
2011-11-22 06:10:33 » |
|
If it was null, "null" would be printed. If it wasn't null, you would get java.io.InputStream@<hashcode>.
It did not print anything at all. Im definite that the block is executed, but it doesnt print. Can I show you, in some way? I can upload the applet, and you can look at errors/source for yourself if you would like :-)
|
|
|
|
ra4king
|
 |
«
Reply #29 - Posted
2011-11-22 06:11:54 » |
|
Sure!
|
|
|
|
|