I have a nasty problem referencing resources when using a Maven project and Jar files...
I have all my resources in a dedicated folder /src/main/resources which is p
Just copy the file to a temporary directory.
String tempDir = System.getProperty("java.io.tmpdir");
File file = new File(tempDir.getAbsolutePath(), "filename.txt");
if (!file.exists()) {
InputStream is = (getClass().getResourceAsStream("/filename.txt"));
Files.copy(is, file.getAbsoluteFile().toPath());
}