String sql="select * from t_pub_uid limit 10"; Listcommand = new ArrayList (); command.add("hive"); command.add("-e"); command.add(sql); List results = new ArrayList (); ProcessBuilder hiveProcessBuilder = new ProcessBuilder(command); Process hiveProcess = hiveProcessBuilder.start(); BufferedReader br = new BufferedReader(new InputStreamReader(hiveProcess.getInputStream())); String data = null; while ((data = br.readLine()) != null) { results.add(data); } System.out.println(results.toString());