java.io.FileNotFoundException: res\FlubberFlap.png (The system cannot find the p
ath specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:131)
at FSMain.MainFS.main(MainFS.java:68)
In line 68 I use:
wood = TextureLoader.getTexture("PNG", new FileInputStream(
new File("res/Baddy.png")));
Someone said not to use a new file, but im not sure exactly what to do. If you can look at my source, my main class is MainFS.
Remember, if itâs in a Jar itâs not typically accessible through the strema. You have to do somethinâ extra to get it. Try (And replace THISCLASS with the class making use of that command):
wood = TextureLoader.getTexture("PNG", MainFS.class.getResourceAsStream(ef.getPath()));code] and got the exception :
Exception in thread âmainâ java.lang.NullPointerException
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)
at FSMain.MainFS.main(MainFS.java:75)
Exception in thread "main" java.lang.NullPointerException
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)
at FSMain.MainFS.main(MainFS.java:75)
Only other thing I can think of is that the file isnât being loaded correctly some way.
Try: The getResouceAsStream and then print out its type. It might be that youâre not getting anything because the file isnât showing up in the .jar.
[quote]If the name begins with a â/â (â\u002fâ), then the absolute name of the resource is the portion of the name following the â/â.
Otherwise, the absolute name is of the following form:
modified_package_name/name
Where the modified_package_name is the package name of this object with â/â substituted for â.â (â\u002eâ).
[/quote]
And then put a res folder in the same folder with the jar. This is a really cool thing to do when you want your players to be able to edit your textures like texture packs in Minecraft. I believe thats how Notch did that anyways.
Given the topic title, Iâm assuming that OP wants the resources in the jar.
Also, doing so doesnât stop anyone who wants to from modifying resources.
[quote]This is a really cool thing to do when you want your players to be able to edit your textures like texture packs in Minecraft.
[/quote]
So yes, I know that people can edit it. And thats kinda what you wanted them to do. Well, if you wanted texture-packs anyways.