Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

invoking an exe file from servlet

 
Vishnu Murthy
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi all,
In one interview which i have attended recently ,
he asked "How to invoke an .exe file from Servelt?"
i couldn't answer to it. is it possible to invoke an exe file from servlet? can any one pl. answer my question.

thank u
vishnu
 
Ashwin Desai
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
By invoking an .exe, I assume you mean running it on the server side itself.
You can do that in any Java program (not necessarily servlet) by using
Runtime.getRuntime().exec(String command)
or similar overloaded methods in class java.lang.Runtime.
Refer to the Java 2 Specification for details at http://java.sun.com/products/jdk/1.2/docs/api/index.html
On the other hand,
If you want to send an .exe file to the browser, then read the .exe file from the file location using a InputStream (since binary data) and write it to the response output stream (response.getOutputStream()).

Ashwin.

[This message has been edited by Ashwin Desai (edited March 01, 2001).]
[This message has been edited by Ashwin Desai (edited March 01, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic