Jason Janelle wrote:
> 
> Hi fellow coders,
>    I have been writing java on WindowsNT boxes for a while and am just
>    trying out java on Linux.  I was trying to issue a command to the
>    system via this line of code:
> 
>    Runtime.getRuntime().exec("ls > dir.txt");
> 
>    It compiles and such but I get no dir.txt.  I tryed a waitFor()
>    statement but no help.  In windows you have to do "cmd /c dir >
>    dir.txt" in the exec() and I was wondering if you have to specify a
>    shell for linux to run in as well.  BTW I'm running Mandrake 7.0.
>    Any Ideas?

Output redirection is a feature of the command line shell, /bin/csh, /bin/sh, 
/bin/bash, etc.  /bin/ls doesn't know what to do with
>.  Try:

"/bin/sh ls >dir.txt"


--
Joi Ellis                    Software Engineer
Aravox Technologies          [EMAIL PROTECTED], [EMAIL PROTECTED]

No matter what we think of Linux versus FreeBSD, etc., the one thing I
really like about Linux is that it has Microsoft worried.  Anything
that kicks a monopoly in the pants has got to be good for something.
           - Chris Johnson


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to