public static void releaseProcess(Process p) {
        Exception ex = null;

        if ( p != null) {
            try { p.getInputStream().close(); } catch ( Exception iex) { iex.printStackTrace(); }
            try { p.getOutputStream().close(); } catch ( Exception oex) {oex.printStackTrace(); }
            try { p.getErrorStream().close(); } catch ( Exception eex) { eex.printStackTrace(); }
            try { p.destroy(); } catch ( Exception dex) { dex.printStackTrace(); }
        }

        if  ( ex != null)
            ex.printStackTrace();
    }