The typically method to reference a file contained with a JAR file is to use ClassLoader.getResource
. Is there a way to get the contents of a directory within a JAR files (similar to java.io.File.listFiles()
)? Note that the JAR file is within the classpath and its filename might not be known during runtime.
Basically I have a bunch of non-.class resource files within a directory. At runtime I need to load each resource file contained within a known directory.