My application is a JAR file and I am needing to get a group of resources all at one time with specifically specifying the file names. I know how to get a single resources, for example. getClass().getClassLoader().getResource("") but I have a directory full of images and I need to get all the image names.
So basically, if I were to do this outside of a JAR file I would do something like:
And that would get all my file names in the File[] array. Is there an easy method of doing the same thing from within a JAR? You can't get File objects when your application is running from a JAR because it will look outside the JAR file for those resources.
Hi Gregg, there is a piece of code over at the Java Almanac that shows you how to list the entries of your JAR file. With that, you can get your images back.