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
  • 667
  • 2
  • 11
  • 22

1 Answers1

-1

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
  • 722
  • 2
  • 11
  • 21