javawindowsfile-handlingdesktoprecycle-bin

How to empty Recycle Bin using Java in Windows?


Since Java Version 9, one can just move files to Recycle Bin, rather than deleting it permanently, using the

java.awt.Desktop.getDesktop().moveToTrash(file)

method. But, I am also willing to know whether there is a way to Empty the Recycle Bin in Windows using Java 9 or higher versions, for some reasons in my Application?


Solution

  • No. That's not supported and probably never should be