浏览 1143 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2012-05-08
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 不能正确运行shell文件,但是linux终端下面可以正确运行shell文件,本人是菜鸟,还望各位解答,谢谢。 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |