Re: [JSP ] 如何使用JSP執行外部程式
下面幾個方向提供您參考:
*妳是要在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
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 4 篇):