Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Runtime.exec problem

 
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 ]
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • 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.
 
Marshal
Posts: 25965
70
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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • 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.
 
It's a tiny ad. At least, that's what she said.
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic