This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
When you run the command from the shell, the shell interpreter understands that you want to run one program and pipe the output to another. When you use Runtime.exec, it takes the entire command line and throws it at cat. Cat tries to open files like "|" and "-p" and fails. You have to exec the shell and pass it the command as arguments or through standard input. Here is a good article on using Runtime.exec and the pitfalls it contains.