Start windows program in browser

Posted on 2005-04-09
Last Modified: 2011-09-20

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,
Question by:jphendriks
    1 Comment
    LVL 8

    Accepted 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);
    Directory:<%= line %>


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Suggested Solutions

    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now