Here you can find the source of runCommandArray(String[] command)
Parameter | Description |
---|---|
command | a parameter |
public static void runCommandArray(String[] command)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { /***/*from w w w .j ava2s . co m*/ * Run curl command * @param command */ public static void runCommandArray(String[] command) { Process p = null; try { p = Runtime.getRuntime().exec(command); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = null; try { while ((line = input.readLine()) != null) System.out.println(line); } catch (IOException e) { e.printStackTrace(); } try { p.waitFor(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }