On 3 Dec 2000, Reghunath P D wrote:

> I have encountered a problem with Runtime;
> 
> code::
> ******
> 
> Runtime.getRuntime().exec("ls ") is not working
> It gives a message: the reaped pid = <some no>
> on linux

On a unix host your commands are running without benefit of a shell.
You must provide the full path to the command.

   Runtime.getRuntime().exec("/bin/ls ") 

> and the same thing on windows9x and NT 
> Runtime.getRuntime().exec("dir") is also not working
> It gives a message: create process error no= <some number>

On dos/windows platforms, 'dir' is a built-in function of the command line
shell, command.com/cmd.exe/whatever.  Try this:

   Runtime.getRuntime().exec("c:\command.com /c dir") 


Question: Why are you using platform-specific stuff instead of
java.io.File.list()?

-- 
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