Hi all, I have a strange runtime.exec problem: Depending on the command, the command is executed or not. First, here's the code:
When I copy the command I printed out and execute it from the command line. On the other hand, executing a simple scipt in the same folder and with the same permission as my "real" command works... any ideas what's wrong?
Thanks a lot! Cheers Ben
[Edited to use code tags - Paul Sturrock] [ September 18, 2006: Message edited by: Paul Sturrock ]
Some programs are real unhappy to have their standard input closed on them, as you're doing here as soon as you launch the process. Perhaps that's it. Or perhaps your busy-waiting is consuming so much CPU time that the process can't get enough CPU to launch before the timeout.
One reason why you can't run some commands, like "dir" and "copy" directly using Runtime.exec(), is because those commands are not really executables - there is no "dir.exe" or "copy.exe" on your computer. Those commands are built-in into the command prompt window, so you can't start them as if they are programs on the system.