I have a list of files in a directory on the classpath that I need to read, and would prefer using the File API, but it appears I can't do that within an archive. This works on my local environment unit test, but when I deploy as a WAR inside an EAR, the listing of the files returns null:
File dir = new File(getClass().getClassLoader().getResource("mydir").getPath());
File[] files = dir.listFiles();