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.