As you can see, I'm deleting all the files inside and making sure the directory is empty before deleting it. Yet it won't get deleted. I have even tried using FileUtils (commons api) but even that gives the same result.
Note that Windows won't let you delete a directory if any process has that directory as its current working directory, or if the directory is not empty. It won't let you delete a file that's open for reading or writing. I notice in this code you're not checking the boolean return value of delete(), which returns false for failure.
Im using windows and have full control on the directory. And the boolean value returned is false even when the directory is completely empty. I can delete the folder manually just fine