windows下tomcat调用cgi报错
如题
用C写exe程序手动正常执行,但是放在tomcat应用里面报错```
错误如下:
java.io.IOException: CreateProcess: "cmd \c" C:\tomcat-6.0.32\webapps\examples\WEB-INF\cgi\cgi_test.exe error=2
java.lang.ProcessImpl.create(Native Method)
java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
java.lang.ProcessImpl.start(ProcessImpl.java:30)
java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
java.lang.Runtime.exec(Runtime.java:591)
org.apache.catalina.servlets.CGIServlet$CGIRunner.run(CGIServlet.java:1647)
org.apache.catalina.servlets.CGIServlet.doGet(CGIServlet.java:609)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
c代码如下:
#include <stdio.h>
void main(){
FILE* file=fopen("aaa.txt","w");
fprintf(file,"hellow");
fclose(file);
fprintf(stdout,"content-type:text/html\n\n");
fprintf(stdout,"hellow world!");
}