如何使用eclipse编写和执行PIG Latin

时间:2016-03-11 07:54:37

标签: java eclipse apache-pig

我想在windows中从eclipse执行Pig脚本。我跟着this link。但它没有用。是否需要插件才能执行此操作?或者只有pig.jar没问题?

1 个答案:

答案 0 :(得分:0)

试试这个,它有效

Runtime runTime = Runtime.getRuntime();
String pigCommand = "pig -f "+pigPath+"  //pigPath must be hdfs path.
Process proc = runTime.exec(pigCommand);
BufferedReader bri = new BufferedReader(new InputStreamReader(proc.getInputStream()));
BufferedReader bre = new BufferedReader(new InputStreamReader(proc.getErrorStream()));

String line = "";

while ( (line = bri.readLine()) != null);
while ( (line = bre.readLine()) != null);