作者willieliao (Willie Liao)
看板java
标题Re: [JSP ] 如何使用JSP执行外部程式
时间Thu Jan 18 07:22:52 2007
下面几个方向提供您参考:
*你是要在client端还是server端执行?client端是不可能的,不然有人在
jsp里面写个format c:那就天下大乱了。
*如果你要在server端执行的话,那个exe档案有没有在path里面?
*最後,你的applcation server是啥?version?jre version?security settings?
willie
※ 引述《fakinsky (啾咪啾咪)》之铭言:
: 我们写的一个EXE档
: 把它套进呼叫外部程式的范例
: 可是都无法顺利执行EXE档= ="
: 是因为路径还有设好吗??
: 还是JSP只能呼叫JAVA编译的档案??
: <%@ page contentType="text/html;charset=big5" session="false" import="java.io.*" %>
...
恕删部分tags
: <%
: Runtime runtime = Runtime.getRuntime();
: Process process =null;
: String line=null;
: InputStream is =null;
: InputStreamReader isr=null;
: BufferedReader br =null;
: try
: {
: process = runtime.exec("cmd /c GA200_onemonth");
: is = process.getInputStream();
: isr=new InputStreamReader(is);
: br =new BufferedReader(isr);
: out.println("<pre>");
: while( (line = br.readLine()) != null )
: {
: out.println(line);
: out.flush();
: }
: out.println("</pre>");
: is.close();
: isr.close();
: br.close();
: }
: catch(IOException e )
: {
: out.println(e);
: runtime.exit(1);
: }
: %>
恕删部份tags
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 69.143.17.31