Search code examples
javashellargumentsexecute

how to run shellscript with argument through java


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);

Solution

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

     String[] cmd = { "bash", "/home/admin/Desktop/test_full_incremental.sh", "-F" };