I want to redirect the output to text file using Runtime.getRuntime().exec("ls > 1.txt")
but it doesn't work. I tried by passing string array instead of string but it didn't work.Other commands such as opening open
is working fine.
Is there any solution to redirect the output to a text file.