-1

currently I am trying to give terminal commands, the code is below:

p = Runtime.getRuntime().exec(new String[]{"/bin/sh","-c","hadoop fs -cat /user/hive/warehouse/new_cur2/* > /home/leo/new_cur2.csv"});

It is giving me the error exit: 127 Can anyone fix it please?

Many thanks

1 Answers1

0

From this 127 Return code from $? the error code means the command is not found in your path. Make sure your PATH is correctly setup.

John Muiruri
  • 26
  • 1
  • 1
  • 6
  • Thanks, you are right, but the path is correct, if I put the command part hadoop fs -cat /user/hive/warehouse/new_cur2/* > /home/leo/new_cur2.csv in terminal, it will work – Christian Leo May 30 '17 at 21:30
  • Because when I was trying to run the command in Java, if I want to create a shell, it is necessary to use "/bin/bash","-c". https://stackoverflow.com/questions/4916918/java-execute-a-command-with-a-space-in-the-pathname – Christian Leo May 30 '17 at 21:51