This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System call using Runtime object question.

 
Jeff Madrid
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's my code:

String[] cmd =
{"/usr/sbin/myCommand", "myParam", "/home/myHomeDir/myFile"};
Runtime.getRuntime().exec(cmd);

I'm running RedHat Linux. No exceptions are thrown but nothing happens to my file.

Question: What's wrong?

Thanks in advance.

Jeff
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, not exactly a Servlets question methinks...

There's more to Runtime.getRuntime().exec() than meets the eye. Check out this article from JavaWorld.com, which is a bit old but should tell you what you need to know.

Jules
 
Jeff Madrid
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I check the article out.

BTW, I forgot to mention I'm making the call from a Servlet. Still not exactly a Servlet question tho.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic