I need to create a Collection<URL>
from resources (files) residing in a specific folder. This folder may be accessed directly as a file: URL, or it may be contained in a jar file, access开发者_高级运维ed via a jar: URL. I know how to enumerate file: folder resources, and how to enumerate members in a jar/zip archive. I wonder if there is a uniform mechanism, saving myself the need to write the code for both cases.
Update: Note that the list of resources is not known at build time.
I wonder if there is a uniform mechanism, ..
Sure:
- Create a list of the resources (at build time).
- Put that list at a known location.
- Load the list to find out what resources are available, and their names.
精彩评论