[JSP ] 將perl作為外部程式呼叫的問題

看板java作者 (haha)時間16年前 (2009/07/28 21:20), 編輯推噓0(002)
留言2則, 2人參與, 最新討論串1/2 (看更多)
小弟我想要在linux中 使用一個jsp讓使用者輸入後交由perl去運算 以下是咕狗到的一段code我再改寫的 String[] cmd={"/home/uber/ViennaRNA-1.8.3/Perl/RNAfold.pl"}; Runtime o_run = Runtime.getRuntime(); Process process = null; InputStreamReader isr = null; BufferedReader br =null; InputStream is = null; String line=null; try { process =o_run.exec(cmd); 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("44444444"); o_run.exit(1); } 執行完後並沒有顯示出任何東西 我覺得比較可能有問題的是cmd字串 可是我在終端機裡直接打字串內容是可以正確執行那個perl程式的 但在jsp呼叫時卻不能 想請問大家有沒有甚麼解決的方法 謝謝大家!!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.120.14.146 ※ 編輯: bbolon 來自: 140.120.14.146 (07/28 21:20) ※ 編輯: bbolon 來自: 140.120.14.146 (07/28 21:25)

07/28 23:54, , 1F
把 perl 改寫成 cgi 讓 java 透過網路連也可以啊:P
07/28 23:54, 1F

07/29 10:22, , 2F
你要等perl script執行完,而且權限有設對嗎?...
07/29 10:22, 2F
文章代碼(AID): #1ARli1zb (java)
文章代碼(AID): #1ARli1zb (java)