Im writing an app that needs to load a number of xml files from a data directory. The app will be packaged in a jar which will contain a data directory with some xml files already in. The app will also look for a data directory external to the jar and load any xml files it finds in there too.
I use the following line of code to retrieve a URL to the data directory:
Enumeration<URL> dataURLs =
When I was debugging the app (not in a jar) I had the data directory on the local file system and the following code worked for getting the files in the directory:
URL url = dataURLs.nextElement();
File dir = new File(url.getPath());
String files = dir.list();
However, once its all jared up this code does nothing and none of the xml files are loaded.
So, my question is: How do I list files that may or may not be inside a jar given a URL to the directory they are contained in?