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

Using Runtime.exec in a web application

 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to open a browser in a servlet




This had printed the Hai on the browser but didn't open the browser .

Is there anything wrong in my code?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly where did you expect the process to execute??

Servlet code gets executed on the server, sending the response ("Hai") to the client.

You will need Javascript or some other technology to start processes on the client side.

Bill
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:Exactly where did you expect the process to execute??

Servlet code gets executed on the server, sending the response ("Hai") to the client.

You will need Javascript or some other technology to start processes on the client side.

Bill


So you mean to say that it is not possible to use Runtime inside the web application.??
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runtime.exec works fine in a web app. But you can't use it to execute processes on the client, because it runs on the server.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Runtime.exec works fine in a web app. But you can't use it to execute processes on the client, because it runs on the server.


Hey Thank you very much . You mean to say for purposes like running Batch Commands from servlets/JSP
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic