Send an Input to a Command
import java.io.OutputStream; public class Main { public static void main(String[] argv) throws Exception { String command = "cat"; Process child = Runtime.getRuntime().exec(command); OutputStream out = child.getOutputStream(); out.write("some text".getBytes()); out.close(); } }