Moving the file isn't sufficient ... see: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5080625
As a quick workaround for windows:
- download "recycle.exe" in the zipfile from: http://www.maddogsw.com/cmdutils
- unzip and place it on your path e.g. in c:\windows\command
- use the following code in Java:
try {
File f = new File("dummy.txt");
Runtime.getRuntime().exec(
"recycle \"" + f.getAbsolutePath() + '"');
} catch (IOException exc) {
exc.printStackTrace();
}
Be sure to have a space after "recycle " to separate the command from its argument.
If you've got more time, you might come up with something more sophisticated using JNI ... but this does the job and it is easy ... streightforward ...
HTH
y0011482
Message was edited by:
y0011482