I have to copy classpath resource from one package to another.
My program is:
public static void main(String[] args) throws IOException, URISynta
I had the same issue and got the exception, noticed there was a space in the filename, so I had to trim it. After that, the issue is resolved.
Path filePath = Paths.get(dirPathStr, newFileName.trim());