• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Runtime.exec problem

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 27372
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
What's that smell? Hey, sniff this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic