Executing a batch file from a JSP page

Discussion in 'Java' started by vineetha, Oct 8, 2007.

  1. vineetha

    vineetha

    Joined:
    Oct 5, 2007
    Messages:
    1
    Hi,

    I am trying to execute a batch file from a JSP page.But when i run the JSP page using tomcat,my tomcat stops the service.I am using Tomcat version 5.5 and JDK version 1.5.
    But when i run the same code using command prompt,i get the output.
    The following are the contents of my JSP page.

    <html>
    <title>hello world</html>
    <body bgcolor=pink>
    <%

    try
    { Process proc = Runtime.getRuntime().exec("C:/vin.bat");
    System.exit(0);
    }
    catch (Throwable t)
    {
    t.printStackTrace();
    }

    %>
    </body>
    </html>

    The batch file vin.bat contains the following lines:
    start c:/hello.txt

    Pls help me to figure out a solution.

    Thanks & Regards,
    Vineetha
    vineetha, Oct 8, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. alexjaquet@gmail.com
    Replies:
    0
    Views:
    4,337
    alexjaquet@gmail.com
    Jun 2, 2006
  2. anubhakhurana@gmail.com
    Replies:
    8
    Views:
    3,418
    Manish Pandit
    Oct 11, 2006
  3. Alan
    Replies:
    8
    Views:
    665
    rossum
    Jun 24, 2005
  4. Lionel van den Berg

    Executing batch files stored in Jar

    Lionel van den Berg, Nov 11, 2007, in forum: Java
    Replies:
    9
    Views:
    558
    Eugene Zharkov
    Nov 13, 2007
  5. S Hayes
    Replies:
    5
    Views:
    558
    Joe Kaplan \(MVP - ADSI\)
    Apr 28, 2005
Loading...

Share This Page