I have been given an existing program that works fine in Eclipse and I want to compile it for distribution. I have no problem in accessing individual resource files both in Eclipse and from a jar.
However, the program iterates through a bunch of files in a folder and I can't figure out how to replicate the logic so it works both in Eclipse and from a jar.
Some of the original code, as requested:
File[] baseFiles = baseFolder.listFiles();
for (int i = 0; i < baseFiles.length; i++) {
String fileName = baseFiles[i].getName();
if (!baseFiles[i].isDirectory() && fileName.toUpperCase().endsWith(XML)) {
// process file
}
}
I tried a few things . . . didn't record them all. This one gives me an empty enum:
final Enumeration < URL > oneTime = getClass ( )
.getClassLoader ( )
.getResources ( basefolder ) ;
In response to other comments - in particular whether this is a duplicate of other questions - I have modified the Title to make it clearer