Does Java 7 have the ability to put files in the trash, rather than delete them on WIndows? I know that this does not exist in Java 6, but I really thought that it was added in Java 7, but could not find it, if not, there is a third-party library available for this, I do not want to mess with JNI itself.
FWIW you can do it on OSX using the Apple extension
com.apple.eawt.FileManager.moveToTrash()
EDIT: Used the jna library as in the answer. FWIW it is available in the central maven repository, but you need to enable both jna pom and platform pom, since the jar platform is the one that contains the cart method.
<dependency> <groupId>net.java.dev.jna</groupId> <artifactId>jna</artifactId> <version>3.4.0</version> </dependency> <dependency> <groupId>net.java.dev.jna</groupId> <artifactId>platform</artifactId> <version>3.4.0</version> </dependency>
java windows recycle-bin
Paul taylor
source share