3

say under my src/main/resources folder I have several .json files, how can I write java code to retrieve a list containing all those files?

it seems that getClass().getClassLoader().getResources doesn't support wildcard matching.

zanyman
  • 577
  • 9
  • 18

1 Answers1

0

Not sure if this is worth an answer given the duplicates, but you can use this answer to get a list of resource files from the JAR, and then while iterating though the list check if the file is a json file using zip.getNextEntry().getName().endsWith(".json")... if it is, add it to your new list.

Grant Foster
  • 716
  • 2
  • 12
  • 21