I put a file in a folder named "templates" placed in the src/
of my eclipse project. I'm trying to make a copy of that file, and want to edit it. Here's my code:
InputStream source = getClass().getClassLoader().getResourceAsStream("templates/file.docx");
File dest = new File("templates/updatedfile.docx");
try{
Files.copy(source, dest.toPath());
}
catch(Exception e)
{
e.printStackTrace();
}
However, I'm getting a java.nio.file.NoSuchFileException: template/updatedfile.docx! What have I done wrong?
Edit: Sorry, fixed a typo in the code, exact exception is now updated