(still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux

From: JW (jkpangtang_at_yahoo.com)
Date: 12/29/03

  • Next message: Raymond DeCampo: "Re: (still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"
    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


  • Next message: Raymond DeCampo: "Re: (still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"