I have a Java program that uses Runtime.getRuntime.exec to run a Python script, for example:
System.out.println("Flying Circus - running monty.py on " + args[0]);
Runtime.getRuntime().exec("python monty.py " + args[0]);
It works properly on my personal computer, both running from class files and from a JAR file. However, when I move the JAR file to a different computer (with Java and the correct version of Python installed, although I have no idea if it's running official Java or an open-source knockoff such as Gnu Common Java), the python script invocation silently fails with no error.
What's more, when I take the exact same function calls and put them in a minimalistic program that only invokes the python script, it works properly.
I manually checked the program that is having problems and found no evidence of "gotchas" that would cause a silent failure including bad variable clearing, bad variable sharing, blocking/nonblocking and concurrency issues, or threading.
Can someone recommend an alternative or wrapper function that must run the given command and report any form of failures? Failures include: "program didn't run", "command not found on command line", and "program threw an exception or exited with a code other than 0".