Hi Patrice

It does not work because exec("") is the same as exec("",null)
The second parameter are the environment variables (e.g. the path, etc.)
So the command interpreter does�nt know where to find rm.
Try the following:

String envp[] = new String[1];
envp[0] = "PATH=" + System.getProperty("java.library.path");

Runtime.getRuntime().exec("rm -rf path-to-dir", envp);

Hope that helps ;-))

Uwe

-----Urspr�ngliche Nachricht-----
Von: Patrice Le Cozler [mailto:[EMAIL PROTECTED]]
Gesendet: Freitag, 17. Mai 2002 16:41
An: Turbine Users List
Betreff: Runtime.exec() doesn't work


hi,

I need to run a linux command from my Index.java file but when I write :

Runtime.getRuntime().exec("rm -rf path-to-dir");
nothing happens and no Exception is thrown.
what's wrong ?

thanks for answers


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

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

Reply via email to