1

i'm trying to execute shellscript with args program through java

   String[] cmd = { "bash", "-F", "/home/admin/Desktop/test_full_incremental.sh" };
    Process p = Runtime.getRuntime().exec(cmd);
6
  • What is wrong? some exceptions? Commented Jan 2, 2015 at 11:04
  • @AVolpe no exception its unable to take mysql dump Commented Jan 2, 2015 at 11:05
  • What is the observed result ? please detail a little more where you're stuck and what is not working as expected... (But I suspect it is the use of bash without a fully qualified path which is causing you troubles as the PATH env variable of your jre may not include it) Commented Jan 2, 2015 at 11:05
  • Why are you using -F? Commented Jan 2, 2015 at 11:05
  • 1
    you need to change the order, try String[] cmd = { "/bin/bash", "/home/admin/Desktop/test_full_incremental.sh", "-F" }; Commented Jan 2, 2015 at 11:08

1 Answer 1

1

You need to change the order of the parameters, try this:

 String[] cmd = { "bash", "/home/admin/Desktop/test_full_incremental.sh", "-F" };
Sign up to request clarification or add additional context in comments.

Comments

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.