JAVA代码如下: try { Runtime rt = Runtime.getRuntime(); String str[] = {"/bin/sh", "-c", "/usr/hadoop-0.19.0/bin/load.sh"}; Process pcs = rt.exec(str); BufferedReader br = new BufferedReader(new InputStreamReader(pcs.getInputStream())); String line = new String(); if(textarea.getText()!=null) textarea.setText(""); while ((line = br.readLine()) != null) { textarea.append(line); textarea.append("\n"); } try { pcs.waitFor(); } catch (InterruptedException e) { System.err.println("processes was interrupted"); } br.close(); } catch (Exception e) { e.printStackTrace(); } Shell文件如下: #!/bin/sh bin/hadoop fs -mkdir input bin/hadoop fs -put input1.txt input
添加回答
举报
0/150
提交
取消