Does the user that turbine is running under have permission to delete the
directories?

-----Original Message-----
From: Patrice Le Cozler [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 10:05 AM
To: Turbine Users List
Subject: Re: AW: Runtime.exec() doesn't work


thanks but...

...it doesn't work even when I give the full path to the command ( /bin/rm
on my
system )
and when a command is not found, an exception is thrown.
It seems it's a security problem since some commands work fine provided that
no
file is deleted ( for example "cp dir1 dir2" is ok if dir2 doesn't exist ).
 But I need to delete some files.

"Schmidt, Uwe" wrote:

> 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]>


--
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