Does Java 7 have the ability to put files in the trash, rather than delete it in Windows

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> 
+8
java windows recycle-bin
source share
1 answer

I think the answer is No.

Third-party libraries exist and this is supported in JNA (see Java on Windows: how to delete a file for garbage (using JNA) ), but this functionality is not part of the standard Java 7 platform , AFAIK.

This RFE tends to confirm this: http://bugs.sun.com/view_bug.do?bug_id=5080625

+2
source share

All Articles