<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.io.BufferedReader"%>
<%@page import="java.io.InputStreamReader"%>
<%@page import="java.io.IOException"%>
<%@page import="java.io.File"%>
<%@page import="java.io.FileInputStream"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
My JSP 'index.jsp' starting page
<%
String s = null;
String file="shoes10059.stl";
try {
// run the Unix "slic3r —load config_m2.ini xxxx.stl" command
// using the Runtime exec method:
Process p = Runtime.getRuntime().exec("C:/Program Files (x86)/Slic3r/slic3r-console --load D:/m2/config_m2.ini"+" "+"D:/m2/"+file+"> D:/m2/log.tex");
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(p.getErrorStream()));
// read the output from the command
out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null) {
out.println(s);
}
// read any errors from the attempted command
out.println("Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null) {
out.println(s);
}
System.exit(0);
}
catch (IOException e) {
out.println("exception happened - here's what I know: ");
e.printStackTrace();
System.exit(-1);
}
%>
这个jsp执行完前端没输出。后台显示结果是
怎么解决????在线等!!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
认证高级PHP讲师