Adding parameters to Runtime.getRuntime()?
问题 void restartWeb() { try { String[] command = new String[] {"webRestarter.exe" , ">>","webLog.log"}; Runtime.getRuntime().exec(command); } catch (java.io.IOException err) { webServer.logError(err.getMessage()); } } Why doesn't this work? How could I fix it so it does work like I want it to? -- Executes webRestarter.exe with parameters >>webLog.log So it'd spit out something like this: webRestarter.exe>>webLog.log 回答1: You simply can't use pipes in a exec call. Pipes are a functionality of the