• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Executing a command-line command from a servlet

 
Anirudh Chandrakant
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic