[JSP ] 將perl作為外部程式呼叫的問題
小弟我想要在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
07/28 23:54, 1F
→
07/29 10:22, , 2F
07/29 10:22, 2F
討論串 (同標題文章)