Re: [JSP ] call shell

看板java作者 (LetMeGoogleThatForYou)時間15年前 (2010/04/29 14:08), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串2/3 (看更多)
※ 引述《fcshpeja (無名氏)》之銘言: : 因為小弟需要做一個線上的系統 : 有用到JSP供使用者上傳資料,再透過我的JAVA程式做運算 : 但是在JSP中使用 : String cmd = "sh /路徑/檔名.sh"; : Process p = Runtime.getRuntime().exec(cmd); : 無法執行JAVA程式,但是可以寫建立(刪除)資料夾的shell : 我也試著直接從java寫call shell,去執行另一隻JAVA程式,測試是沒問題的 : 但是放到JSP就不會動,實在令人不解 : 請問有高手可以救援一下嗎~~感激不盡 與其抓著「無法執行」四個字不放,不如把下面這些東西印出來看看… http://java.sun.com/javase/6/docs/api/java/lang/Process.html abstract int exitValue() Returns the exit value for the subprocess. abstract InputStream getErrorStream() Gets the error stream of the subprocess. abstract InputStream getInputStream() Gets the input stream of the subprocess. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 65.87.177.87 編輯文章修正: 剛剛仔細一看,才發現之前貼錯了… 之前貼的這個 abstract OutputStream getOutputStream() Gets the output stream of the subprocess. 事實上傳回來的是接著 STDIN 的 OutputStream 這個 abstract InputStream getInputStream() Gets the input stream of the subprocess. 才是接著 STDOUT 的 InputStream 沒仔細看清楚文件是我疏乎,然而這兩個 method 的命名方式與 getErrorStream() 相比之下,也實在夠呆的了… ※ 編輯: AmosYang 來自: 65.87.177.87 (04/29 21:22)

04/30 12:21, , 1F
this is not consistent.. XD
04/30 12:21, 1F

04/30 16:38, , 2F
XD
04/30 16:38, 2F
文章代碼(AID): #1BsI9Ssy (java)
文章代碼(AID): #1BsI9Ssy (java)