• Post Reply Bookmark Topic Watch Topic
  • New Topic

Runtime.exec problem  RSS feed

 
Ben Zahler
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Sheriff
Posts: 22827
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Zahler:
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?
This suggests that other things don't work because (a) they expect to be run in a certain directory or (b) they don't have the right permissions.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at this article: When Runtime.exec() won't

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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!