teunie75
teunie75

Reputation: 1

LWJGL load image from jar with slick-util

I'm creating a game with LWJGL, and I want to display the LWJGL logo when the game starts. For that, I need to load the image from the jar file. You can see how I set up my resources here: https://i.sstatic.net/PVo52.jpg

I have been searching, and it appears that you have to use a '/' in front of the path. That didn't work for me, also without the '/' in front. I also tried putting 'jar:' before resources, but it doesn't work either.

Upvotes: 0

Views: 331

Answers (1)

Ben Hack
Ben Hack

Reputation: 91

Instead of using ResourceLoader.getResourceAsStream() use getClass.getResourceAsStream. This will start the path from where your main class is, so you may have to use .. (it goes to the file above). Sorry if this isn't clear or I misunderstood, but this is what I did to load images in a jar.

Upvotes: 1

Related Questions