Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling Linux shell in JSP

 
ajay chaturvedi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Linux shell which take two parameters
how do i call this shell from JSP.
Please help :roll:
 
Shawn Bayern
Author
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by achaturvedi:
I have a Linux shell which take two parameters
how do i call this shell from JSP.
Please help :roll:

You can use Runtime.getRuntime().exec() to call an outside program. Just build up a command-line containing the two arguments and pass it to exec(). (There's an overloaded exec() function that also takes an explicit argument list. See the Javadoc for java.lang.Runtime.)
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"achaturvedi",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Thanks.
Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic