-1
\$\begingroup\$

I have another game that uses rectangles instead of textures which works fine. When I run it I get this error:

C:\Users\Owner>cd desktop

C:\Users\Owner\Desktop>java -jar FLIPPERFLAP1.0.jar
java.io.FileNotFoundException: res\FlubberFlap.png (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:131)
        at FSMain.MainFS.main(MainFS.java:68)

C:\Users\Owner\Desktop>

In line 68 where I load the texture, I do this :

wood = TextureLoader.getTexture("PNG", new FileInputStream(new File("res/SuperGuy.png")));

It works when I use the IDE (eclipse) but not after exported. The images are in a source folder called res. When I use JarSplice do I have to export the textures in natives or jars?

\$\endgroup\$
2
  • \$\begingroup\$ Hello Mr.CodeIt! I've posted an answer in JGO. I'm posting it here too now. \$\endgroup\$ May 9, 2014 at 3:04
  • \$\begingroup\$ Your problem is that you are using FileInputStream to load resources. You should use ClassLoader.getResourceAsStream or similar. See gamedev.stackexchange.com/a/50967/2158 \$\endgroup\$
    – msell
    May 9, 2014 at 5:20

1 Answer 1

-1
\$\begingroup\$

First step is make sure you have the resources bundled with the JAR you create. Try to move the res/ folder inside the src/ folder. And export the jar like this.

enter image description here

And create the fat jar as you did. This gets rid of the Eclipse's JAR in JAR loader.

\$\endgroup\$
8
  • \$\begingroup\$ Woah your the same one on JGO, but do I keep the res/ folder as a source folder or regular folder? Source folders wont go in the src/ \$\endgroup\$ May 9, 2014 at 3:30
  • \$\begingroup\$ You should keep it as a package. Just create a package with res as name and drag the files inside your res folder into it. \$\endgroup\$ May 9, 2014 at 3:46
  • \$\begingroup\$ After I export like you said, where do I get my natives from in jarSPlice? Where I downloaded it? Or do I just put the jar in? \$\endgroup\$ May 9, 2014 at 3:49
  • \$\begingroup\$ You add the jars lwjgl.jar lwjgl-util.jar slick-util.jar and jars of any other libraries you are using. Then add the natives that you have from the LWJGL download. \$\endgroup\$ May 9, 2014 at 3:53
  • \$\begingroup\$ Where do I put my textures? \$\endgroup\$ May 9, 2014 at 19:19

Not the answer you're looking for? Browse other questions tagged .