LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Labrasones on June 09, 2011, 04:05:13

Title: Accessing textures packaged into the jar file?
Post by: Labrasones on June 09, 2011, 04:05:13
I've got a bunch of different image files being used, and I've packaged them all into a "data" folder inside my jar. I'm trying to create a desktop application.

However, I'm not sure how to point to the textures inside the jar with a filepath. Or if this is even possible to use the textures without extracting them first.

Is there a special method I have to call? Or is it just a matter of using the right filepath? I'd do a google search, but I'm not sure what I'd even have to look for.
Title: Re: Accessing textures packaged into the jar file?
Post by: pjohnsen on June 09, 2011, 09:41:07
You can use getResourceAsStream: http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#getResourceAsStream(java.lang.String)