Executing a batch file from a JSP page

Joined
Oct 5, 2007
Messages
1
Reaction score
0
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top