I have been googling for some time, and everyone seems to have a different solution, none of which appear to be working for me.
I have tried both ProcessBuilder and Runtime. Both calling the .sh file directly and feeding it to /bin/bash. With no luck.
Back to basics, my current code is as follows;
String cmd[] = { "~/path/to/shellscript.sh", "foo", "bar" };
Process p = Runtime.getRuntime().exec(cmd);
Which is giving a No such file or directory error, despite that manually running;
~/path/to/shellscript.sh foo bar
Works perfectly from bash.
I need to keep the ~ because this shellscript exists in slightly different forms for three different users.