Greeings, 我试图使用servlet.if运行.bat文件我给静态路径执行bat文件但是当我使用getRealPath方法而不是staic路径.bat文件不执行它也不显示错误? 我的代码是:
ServletContext servletContext = request.getSession().getServletContext();
servletContext = request.getSession().getServletContext();
String path="/batfile.bat";
String blastpath=servletContext.getRealPath(path);
System.out.println(blastpath);
Runtime run = Runtime.getRuntime();
Process p = run.exec(blastpath);
try {
p.waitFor();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}