Build a process pipeline using processbuilder in Java 7
                                        
                    •
                    Java                                    
                I've been trying to figure out how to manage some processes in Java using the new process builder I can't find a suitable example of what I want to do. When I try to do the process myself, the process will hang up I will be very grateful for some running equivalent to cat test Txt | is a simple example of the code WC, but not through the shell
–Update–
OK, just to clarify I know there are some ways to simulate pipes by reading and writing streams I wonder if it can be done in some automatic way through the redirectinput and redirectoutput methods introduced in Java 7
Solution
In this case, you do not need a pipe
"grep bla test.txt"
But suppose you need a pipe, you need to use a shell like bash
"/bin/bash","-c","grep foo text.txt | grep bar"
                            The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
                        
                                            
                        THE END
                    
                    
                    
                                                        二维码
                        
                        
                                                
                        