[SOLVED]Jar Splice

Im using Jar Splice to create a runnable jar/exe of my game but when i do it cant load in any of the image files it needs. Ive opened the jar in winzip and the image file is there in the right folder, but it doesnt load ???

Are you getting any exceptions or just nothing shows up?

If the images are just in the same place as the jar it should work, so if you zip the jar and the images together then it should find them.

You may have done this but if you open your jar with winter then go to where the images should be in your IDE, e.g ‘data’ and add the data file to where it should be inside the jar.

I’ve had this problem before and both of those worked for me.

Most likely cause is that you are loading your resources (images) using java’s File, you can’t use this when loading resources from inside a jar file as they are no longer just on the file system (but inside a zip file). So you need to use an Input Stream to load your resources from the jar.

As ‘actual’ mentioned above, if you run the jar on the command line (using “java -jar yourjar.jar”) you’ll probably get an exception telling you that it can’t find the resources. Use Huw’s above method to work around the problem to confirm that it is the above issue, if so you need to change the way you load resources in your code from using File to InputStream.

Ok thanks everyone, i realize my mistake now :slight_smile: