Hi again,
I tried:
String[] cmd = { "/bin/rm", "-f", "junk*" };
with:
Runtime.getRuntime().exec(cmd) ;
and still no luck.
I even tried sticking the command "rm -f junk*" in
an executable file "script.scr" and calling
the java file containg the lines:
Runtime.getRuntime().exec(cmd)
where
String cmd ="./script.scr".
Nothing happened as well.
I use "rm" as an example.
I may need to call other applications, such as "/sbin/shutdown".
Thanks again in advance.
scott@slp53.sl.home (Scott Lurndal) wrote in message news:<oZkHb.2779$Qh5.2570@newssvr25.news.prodigy.c om>...[color=blue]
>
jkpangtang@yahoo.com (JW) writes:[color=green]
> >Hi,
> >
> >I don't seem to get any results from the following use
> >of Runtime.getRuntime().exec(cmd) using Java 1.4 on
> >Redhat linux.
> >
> >Suppose that in the same directory as my java file below,
> >I have files junk1, junk2, junk3, and i want
> >to have the java program delete all of these files.
> >
> >However, when I run the following code,
> >no deletion occurs.
> >What am I doing wrong?[/color]
>
> It is 'exec', not 'execvp'. You need to provide the
> full path to the executable:
>
> String[] cmd = { "/bin/rm", "-f", "junk*" };
>
> scott[/color]