send file to Recycle bin

Hello,Any body please tell me how can i delete a file through java program which must be visiable in Recycle bin. After delete the file, file must be move to Recycle bin.Any help pleasethanks in Advance
[230 byte] By [raviadhaa] at [2007-10-3 3:50:30]
# 1
Java is paltform-independent."Recycle bin" is pertinent to some platform(s). So you"ll have to use some external command. Confer your platform's documentation.
BIJ001a at 2007-7-14 21:47:58 > top of Java-index,Core,Core APIs...
# 2
In windows is a hidden directory "RECYCLER" under root.Try typing "C:\RECYCLER" in the explorer adress, and see how the files are organized. Try to move files programmatically to and from this directory.Gil
gilroittoa at 2007-7-14 21:47:58 > top of Java-index,Core,Core APIs...
# 3

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

y0011482a at 2007-7-14 21:47:58 > top of Java-index,Core,Core APIs...