I have found a method that helps me copying one file out of my current running jar. But i need to copy the whole folder structur. When I change the Input and Output to match my Folder its not working
InputStream stream = Main.class
.getClassLoader().getResourceAsStream("res/szenario/home.html");
FileOutputStream fos = null;
try {
fos = new FileOutputStream("home.html");
byte[] buf = new byte[2048];
int r = stream.read(buf);
while(r != -1) {
fos.write(buf, 0, r);
r = stream.read(buf);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if(fos != null) {
try {
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}