The problem is that I need the file to move before the rest of my logic will work so when the method returns false I stop execution.
However, when I check on the fil
Java's File.renameTo() is problematic, especially on Windows, it seems. As the API documentation says:
Many aspects of the behavior of this method are inherently platform-dependent: The rename operation might not be able to move a file from one filesystem to another, it might not be atomic, and it might not succeed if a file with the destination abstract pathname already exists. The return value should always be checked to make sure that the rename operation was successful.
You can use apache.commons.io library, which includes FileUtils.moveFile() or also the Files.move() method in JDK 7.