Hi anyone,

I'd like to delete a file with a servlet. I tried it with the delete()
function and with the runtime.exec() function. What am I doing wrong?

Here's my code:
Solution 1:
[...]
String cmd = "del C:\\" + request.getParameter("Id") + "-" + eleno + ".xml";
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(datname)
[...]

Solution 2:
[...]
String datname = "C:\\" + request.getParameter("Id") + "-" + eleno + ".xml";
boolean success = (new File("datname")).delete();
if (!success) {
        out.println("Couldn't delete file: " + datname);
}
[...]

Regards,
Anne


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to