Hi.
I recently finished and application and created a jar file.
One of my classes creates an output directory populating it with files from it's resource.
The code is something like this:
// Copy files from dir "template" in this class resource to output.
private void createOutput(File output) throws IOException {
File template = new File(FileHelper.URL2Path(getClass().getResource("template")));
FileHelper.copyDirectory(template, output);
}
The problem is that now that I am running for a jar, this doesn't work.
I tried without luck:
Using Streams to solve similar stuff
on other classes but it doesn't work
with dirs. Code was similar to
http://www.exampledepot.com/egs/java.io/CopyFile.html
Creating the File template with new File(getClass().getResource("template").toUri())
While writting this I was thinking about instead of having a template dir in the resource path having a zip file of it. Doing it this way I could get the file as an inputStream and unzip it where I need to. But I am not sure if it's the correct way.
Thanks for reading!