Following command runs and redirects output to file when I run it on RedHat Linux command line:
mycommand &> mycommand.log
I want to run this command using Java but when I do that it displays command output on STDOUT instead of writing to file:
String command = "mycommand &> mycommand.log";
Process.getRuntime().exec(command);
I cannot use Process.getInputStream()
because this command is meant to be executed by another Java process and their Java implementation is hidden from the user, so the redirection must happen within the command and not using Java APIs.