-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
  • You could try splitting the command into separate strings, afaik that is a requirement any ways. Commented May 30, 2017 at 21:36

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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
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". stackoverflow.com/questions/4916918/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.