2013-10-15 51 views
0

我的WGET命令不在我的32BIT JRE下工作,但在64位版本上它運行得很好。有任何想法嗎?wget命令在32位JRE不工作

java.io.IOException: Cannot run program "wget": CreateProcess error=2, cannot find file 

String command = "wget --quiet -O \""+props.getProperty("xmlFolder")+""+rs.getString("software")+".xml\" \"ftp://"+props.getProperty("ftpUser")+":"+props.getProperty("ftpPasswort")+"@"+rs.getString("xmlPfad")+"\""; 

       System.out.println(command); 
       Process p = Runtime.getRuntime().exec(command); 

       p.waitFor(); 
+0

它說'CreateProcess錯誤= 2,找不到文件。這是否給你一個提示? – devnull

+0

根本不是,因爲當我在NetBeans中將我的JRE切換到64位時,它工作正常。 –

+0

,我知道該文件存在。 –

回答

0

不要試圖在java中用單個字符串和引號執行進程。將每個參數分隔成一個單獨的java字符串並使用exec(String[])方法。

然後,找出爲什麼wget不在PATH中,並將其添加到PATH或使用可執行文件的絕對路徑。

+0

好的,我會試試看。但是當我將命令複製到我的命令行時,它工作正常。它不在我的netbeans程序中工作。 –