I am using Runtime.getRuntime().exec() to run a shell script from java code. The code works fine when I pass the parameter as string
Runtime.getRuntime
First string became the command. There is no file 'sh test.sh' to be executed.
Change
String[] cmd = {"sh test.sh", "/Path/to my/resource file"};
to
String[] cmd = {"sh", "test.sh", "/Path/to my/resource file"};
(In general use process builder API)