>>>>> Marius Schamschula writes:

    Marius> Hi there,
    Marius> I am having trouble getting Runtime.exec () to do anything
    Marius> (yes I do send the desired command as an
    Marius> argument...e.g. "/bin/ls /home/someusr/dir >
    Marius> /home/someusr/test"). I've tested my code on both a
    Marius> mkLinux (DR2.1u5) and Debian Linux machine running various
    Marius> flavors of JDK 1.1.x. I'm trying to use Java to directly
    Marius> invoke various shell scripts. I do a waitFor () for the
    Marius> process to terminate, check the InputStream and
    Marius> ErrorStream. The streams are empty...

    Marius> Any hints?

You need a shell if you want to use '>':

            Process p = Runtime.getRuntime().exec(new String[] {
                "/bin/sh", "-c", 
                "/bin/ls /home/someusr/dir > /home/someusr/test"});



        Juergen

-- 
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802

Reply via email to