How can I call a shell script through java code? I have writtent the below code. I am getting the process exit code as 127. But it seems my shell script in unix machine is never called.
String scriptName = "/xyz/downloads/Report/Mail.sh";
String[] commands = {scriptName,emailid,subject,body};
Runtime rt = Runtime.getRuntime();
Process process = null;
try{
    process = rt.exec(commands);
    process.waitFor();
    int x = process.exitValue();
    System.out.println("exitCode "+x);
}catch(Exception e){
    e.printStackTrace();
}
 
     
     
     
    