Re: trouble with Runtime.getRuntime().exec(cmd) on Linux
From: Scott Lurndal (scott_at_slp53.sl.home)
Date: 12/27/03
- Next message: Brad BARCLAY: "Re: Anybody use Java with USB devices?"
- Previous message: Harry: "Make RotationEffect working"
- In reply to: JW: "trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Next in thread: JW: "(still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Reply: JW: "(still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 27 Dec 2003 19:21:56 GMT
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: Brad BARCLAY: "Re: Anybody use Java with USB devices?"
- Previous message: Harry: "Make RotationEffect working"
- In reply to: JW: "trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Next in thread: JW: "(still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Reply: JW: "(still) Re: trouble with Runtime.getRuntime().exec(cmd) on Linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]