I used the following code to get the path
Path errorFilePath = FileSystems.getDefault().getPath(errorFile);
When I try to move
The path \C:\Sample\sample.txt must not have a leading \. It should be just C:\Sample\sample.txt
\C:\Sample\sample.txt
\
C:\Sample\sample.txt