1

I have some code that reads all filenames from a classpath directory which uses the following:

Thread.currentThread().getContextClassLoader().getResourceAsStream("myClasspathDir/");

Recently we migrated to Tomcat 8.5 and this stopped working. The Apache changelog states that:

Fix: When calling getResourceAsStream() on a directory, ensure that null is returned. (markt)

I need an alternative to read the files from the classpath (no absolute path). We do not use Spring in this application. It is a simple Java application.

Any thoughts on how to get the filenames from a classpath directory? I know there are lots of related answers but they usually use Spring, absolute paths to directories or other solutions that are not applicable.

Diyarbakir
  • 1,999
  • 18
  • 36
  • You need to create your own Scanner See previously ask https://stackoverflow.com/questions/3923129/get-a-list-of-resources-from-classpath-directory – Ori Marko Jun 11 '17 at 05:37

0 Answers0