(still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux
From: JW (jkpangtang_at_yahoo.com)
Date: 12/29/03
- Previous message: Paul: "Re: My webpgage"
- In reply to: Scott Lurndal: "Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Next in thread: Raymond DeCampo: "Re: (still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Reply: Raymond DeCampo: "Re: (still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Dec 2003 13:01:53 -0800
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.com>...
> jkpangtang@yahoo.com (JW) writes:
> >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?
>
> It is 'exec', not 'execvp'. You need to provide the
> full path to the executable:
>
> String[] cmd = { "/bin/rm", "-f", "junk*" };
>
> scott
- Previous message: Paul: "Re: My webpgage"
- In reply to: Scott Lurndal: "Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Next in thread: Raymond DeCampo: "Re: (still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Reply: Raymond DeCampo: "Re: (still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]