java - List files in a directory from a runnable jar -
so i've been trying quite while deal issue have after converting java project(game) runnable jar. issue has way i'm loading resources. i've read in many other answers 1 possible way deal image loading illustration when dealing runnable jar utilize imageio.read(getclass().getresourceasstream(path);
this works perfectly.
but issue in particular folder have 300 pngs need load , way i've been dealing far using file dir
object representing directory , iterating through files in directory using dir.listfiles()
, extracting path , loading them imageio
. problem method throws exception when launching jar.
although theoretically hard code every single image loading 300 pngs know if there way around obstacle.
many , sorry long post!
alex
(update) project hierarchy in eclipse this:
game // project
>src //source code >main //main bundle >loader // loader file >res // resources >images // folder containing 300pngs
get jar running. hints here: get name of running jar or exe.
access jar jarfile/jarentry: http://docs.oracle.com/javase/7/docs/api/java/util/jar/jarfile.html#entries().
java image jar loading executable-jar
No comments:
Post a Comment