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
You simply can’t use pipes in a
execcall. Pipes are a functionality of the shell and not of the operating system. So we have to call the shell executable and pass the command. Try this instead: