aspose file tools*
The moose likes Servlets and the fly likes Executing a command-line command from a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Executing a command-line command from a servlet" Watch "Executing a command-line command from a servlet" New topic
Author

Executing a command-line command from a servlet

Anirudh Chandrakant
Greenhorn

Joined: Mar 23, 2004
Posts: 5
Hi,

I would like to execute a command-line command from within a servlet. For example, i would like to run "Runtime.getRuntime().exec()".

But, this somehow doesnt get executed. I searched on Google and on these forums but couldn't find any information.

Do i need to do anything to be able to execute this?

Thanks,
Anirudh
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Anirudh Chandrakant:

But, this somehow doesnt get executed.



Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see:
TellTheDetails


What does happen when you execute your servlet?



Again, welcome to JavaRanch and good luck with your question.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12825
    
    5
The common problem with exec() - frequently discussed in detail in these forums - has to do with consuming the output streams created by Process created. Read the Javadocs for java.lang.Process.

Bill
Durgaprasad
Greenhorn

Joined: Oct 02, 2006
Posts: 17
Runtime.exec() method is used to run the process( exe files).
For example call Runtime.exec("notepad") and see the results.

Even i dont know how to pass arguments to the servlet
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"Durgaprasad",

I counted 6 warnings before I stopped counting. You only get 3.

I'm closing your account, please register with a display name which follows the JavaRanch naming rules.

Dave
[ October 25, 2006: Message edited by: David O'Meara ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Executing a command-line command from a servlet