Hi all,

Wondering if anyone could help -

I have a project I'm working on - part of it involves loading a list of resource files at runtime. I can hardcode each file and use the ClassLoader.getResource("....") to get each file, but I was wondering is there a way to search by regex e.g. return a list of all files that match *.json?

The files are all included in the "src/main/resource" folder (I'm using Intellij 12)

Any advice or pointers is much apreciated :)

Absolutely. You can create a File object that refers to the folder, then use its listFiles method to get an array of the Files in it (you can also supply a filter to select only .json files). Details, as always, in the File API doc.

ps Java 7 has new improved classes Path and Files to replace the traditional File class - Google for Java NIO - if you are fully comitted to Java 7 then use these new classes instead.