----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Keith Ball wrote:
> Well thanks for the source code that will help greatly.  I have however
> discoved what I beleive to be a (( BIG )) problem.  (not with you code, I
> hasten to add....)
> 
> Runtime.getRuntime().exec("cd /tmp; mkdir ItWorked");
> 
> Reports the following error....
> 
> "IOException : cd : not found".
> 
> Now I know this is a big problem.  My current user setup in Apache is...
> 
> user : nobody
> group : nogroup
> 
> Anymore Ideas out there?  Or am I doing something blindingly obvious?

Oops forgot to mention that bit, CD is not an actually system command
but rather a shell command. So before you can used cd you need to run a
shell.....

so if you make a String array like so

        String[] command = {"/bin/csh", "-c", "cd /tmp; mkdir ItWorked"};

now do
        Runtime.getRuntime().exec(command);

you'll have a directory.

If you haven't already, have a look at Alan's post. He points out that
it is cheaper to run commands like that inside Java ,using the class
java.io.File, rather than to start a seperate sub process and run
something on the command line.

Rob


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to