Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

Start windows program in browser


I would like to know if it is possible to start a Windows executable from a webpage. For instance a JSP page loads and then the windows program is started. At your choice the windows executable can be on the server or the client. Which permissions are required to do so? Does anyone know where to find sources and documentation for this.

Thanks for an answer.
Best regards,
1 Solution
you can execute the windows program on the server side in the JSP
you can use Runtime.getRuntime() in the scriptlets and output can be displayed in the JSP.
JSP will work on the server side i am not aware of any way to run windows program in the client side.
Sample code for getRuntime() is given below

String cmd[] = new String[3];
cmd[0] = "cmd.exe";
cmd[2]="dir *.txt ";
ArrayList results = new ArrayList();
Runtime runTime = Runtime.getRuntime();
Process process = runTime.exec (cmd);      
InputStream inputStream = process.getInputStream();
InputStreamReader   inputStreamReader = new InputStreamReader (inputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String line = null;
 while ( (line = bufferedReader.readLine()) != null ){
results.add(line); //finally results contain the output
int exitVal = process.waitFor();
System.out.println ("Process exitValue:  " + exitVal );
catch (Throwable t)
Iterator resultIterator = new results.Iterator();
String line = (String)resultIterator.next();
Directory:<%= line %>


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now