Java tutorial
import java.io.BufferedOutputStream; import java.io.OutputStream; public class Main { public static void main(String[] args) { try { // create a new process Process p = Runtime.getRuntime().exec("notepad.exe"); // get the output stream OutputStream out = p.getOutputStream(); // close the output stream System.out.println("Closing the output stream..."); out.close(); } catch (Exception ex) { ex.printStackTrace(); } } }