public void stopBySendingNewLineIntoProcess ( Process process ) throws IOException , InterruptedException { if ( process != null ) { BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( process . getOutputStream ( ) ) ) ; writer . newLine ( ) ; writer . flush ( ) ; process . waitFor ( ) ; } }
Stops process by sending new line to it s output stream .