Please consider the following example Java class (pom.xml below):
package test.filedelete; import java.io.ByteArray
If Files.delete did not throw exception it means it deleted the file. Files.delete javadoc says that "on some operating systems it may not be possible to remove a file when it is open and in use by this Java virtual machine or other programs".