I have a template folder(with files and sub folders) under the resources folder. I need to copy the entire template folder(with all files and sub folders) to another location. I was able to do it by using below line of code:
FileUtils.copyDirectory(new file(this.getClass().getClassLoader().getResource("templates").getFile()), new File(destination));
It works fine when running from IDE, but getting FileNotFoundException when I am running the jar. I found many answers when tried to look for options and tried a few, but they did not work for me. Can someone help me if you know something that worked for you.
My template folder is structured as below inside the jar:
-com [all my classes are under this path]
-templates [I want to copy this(including all files with sub-folders to a diff location)]
-META-INF