Java is not able to locate shell script

I have a maven project. The java classes call a shell script. I have used context.getInitParameter like this:

String[] cmd = {context.getInitParameter("testabc"), value};

to call the shell scripts. In web.xml i have put the path as


After deploying and executing I get the following error: Cannot run program "/bin/bash","": error=2, No such file or directory
    at java.lang.ProcessBuilder.start(
    at java.lang.Runtime.exec(
    at java.lang.Runtime.exec(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(

The file is there, when I do a vi it displays the file, can someone tell me what am I missing here?

Source: unix

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.