CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2000
    Posts
    2

    Runtime.exec() and Win98 : Cannot create process

    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



  2. #2
    Join Date
    Sep 2000
    Location
    Melbourne --> Australia
    Posts
    68

    Re: Runtime.exec() and Win98 : Cannot create process

    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



  3. #3
    Join Date
    Sep 2000
    Posts
    2

    Re: Runtime.exec() and Win98 : Cannot create process

    Thanks, I will try that.


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



  4. #4
    Join Date
    Sep 2000
    Location
    Melbourne --> Australia
    Posts
    68

    Re: Runtime.exec() and Win98 : Cannot create process

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured