Click to See Complete Forum and Search --> : Runtime.exec() and Win98 : Cannot create process


Thery
September 25th, 2000, 03:34 AM
I need to call Runtime.exec("command /c copy myfile a:");

When it is executed an exception is raised with the message "Cannot create process".

This works perfectly on Windows NT 4.

Does anyone know why it behaves like this?
What can I do to make it work on Win98?
Is it a Win16 legacy problem?


Thanks very much for your help

-BT

Phill
September 25th, 2000, 05:44 AM
Hi
This is because the actual file is called
"Xcopy.exe"
So you can run it with:

try{
Process p = Runtime.getRuntime().exec("Xcopy YourFile a:");

p.waitFor();
}catch(Exception e){
System.out.println("Error " + e);
}



Good Luck
Phill

Thery
September 25th, 2000, 06:08 AM
Thanks, I will try that.


So according to you I don't need (mustn't) to use ...exec("command /C ...") on Win98?

Phill
September 25th, 2000, 06:14 AM
Hi
thats right, you dont need the "command" string,
that is just the name of the parameter in
the exec method.
And I think you will find that you only need to specify the path to the file if it isnt in
your working directory.
Phill