private static void handleStreams(final Process p, final OutputStream outStream, final OutputStream errStream, final InputStream inStream) {
   
      //Handle Output
      Thread outThread = new Thread(new Runnable() {
         public void run() {
            try {
               InputStream pOut = p.getInputStream();
               byte buf[] = new byte[64];
               int c = pOut.read(buf);
               while(c != -1) {
                  if(outStream != null) {
                     outStream.write(buf, 0, c);
                  }
                  c = pOut.read(buf);
               }
            }
            catch(IOException ioExp) {
               ioExp.printStackTrace();
            }
         } 
      });
      
      //Handle Error
      Thread errThread = new Thread(new Runnable() {
         public void run() {
            try {
               InputStream pErr = p.getErrorStream();
               byte buf[] = new byte[64];
               int c = pErr.read(buf);
               while(c != -1) {
                  if(errStream != null) {
                     errStream.write(buf, 0, c);
                  }
                  c = pErr.read(buf);
               }
            }
            catch(IOException ioExp) {
               ioExp.printStackTrace();
            }
         }
      });
      
      //Handle Input
      Thread inThread = new Thread(new Runnable() {
         public void run() {
            try {
               if(inStream == null) return;
               OutputStream pOut = p.getOutputStream();
               byte buf[] = new byte[64];
               int c = inStream.read(buf);
               while(c != -1) {
                  pOut.write(buf, 0, c);
                  c = inStream.read(buf);
               }
            }
            catch(IOException ioExp) {
               ioExp.printStackTrace();
            }
         }
      });
      
      outThread.setDaemon(true);
      errThread.setDaemon(true);
      inThread.setDaemon(true);
      
      outThread.start();
      errThread.start();
      inThread.start();
   }