Run a Bat File from JSP
843840Feb 14 2008 — edited Feb 15 2008Hi to all, i been finding almost all my java answers in this forum, so thanx to all of you who answer
Yesterday i was looking how to run a bat file form a JSP page, i found some code, and i use it, bur the JSP seems to run it but doesnt do anything, i took those lines and copy to a stand a lone java class and it did launch the bat file, i dont know if this is a matter of security.. well here is the code is very simple
the bat is in the machine on directory c:\clases
the bat is called Reinicia.bat
and the JSP page code:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<%!
// Declaraciones de clase.
String[] command = { "cmd.exe", "/C", "Start", "C:\\CLASES\\Reinicia.bat" };
%>
<%
// Declaracion secuencial de instruccciones de la clase java del jsp.
Process child = Runtime.getRuntime().exec(command);
%>
<HTML>
<BODY>
Si se ejecuto
</BODY>
</HTML>
when i run the page i only get -->Si se ejecuto
no error code and no bat was launched
hope some one can help me
Ricardo