wood burning stoves 2.0*
The moose likes Servlets and the fly likes System call using Runtime object question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "System call using Runtime object question." Watch "System call using Runtime object question." New topic
Author

System call using Runtime object question.

Jeff Madrid
Greenhorn

Joined: Nov 07, 2003
Posts: 14
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


Jeff
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
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

Joined: Nov 07, 2003
Posts: 14
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: System call using Runtime object question.
 
Similar Threads
How to close dos 'pause' command in Java
accessing java files within folders
How to set the System variable on WINDOWS and UNIX?
Runtime getRuntime() exec(String command) - How does this work?
Controlling Windows Services from a Java App