# How to load resources in LWJGL [duplicate]

I've been searching for days. When I export and create my fat jar it loads and disappears. It can't find my images.

This is what it all looks like. I used something like this to load them:

File a;
a = new File("res/theimage.png");

wood = TextureLoader.getTexture("PNG", new FileInputStream(a));


This works just fine in eclipse but the jar can't find the image. I tried putting the first jar with the fat jar in a folder. It still didn't work so I put all project files in there too. Somehow it couldn't find it still. How do you get your res to be in your lwjgl game. I mainly just want to have a jar file that you click and start easily instead of a zip folder with all the files. I don't know how to do any of this. My game without images works just fine. I rather a visual way of doing this.

Can Images be draw without being textures in LWJGL?

• How is this question different from your previous question? May 11, 2014 at 16:45
• I figured it out May 11, 2014 at 21:43

## 1 Answer

Files embedded in jars are not "files" in the java File object sense, that's why it works just fine when running from Eclipse but not from a Jar. Jar files are zip files. To actually use a file embedded within a jar (a zip file) the file must be decompressed first. You're going to have to extract the images from the jar to the local harddrive when running your game or open your image files as InputStreams.