I've tried the solution with a shutdown hook described above and run into the deadlock. I think the reason was the following:
Without the hook there were no references to the Process instance, and everything went according to API reference:
The subprocess is not killed when there are no more references to the Process object, but rather the subprocess continues executing asynchronously.
Now, when we have a hook, the reference for the Process instance is kept in the Runnable instance we've created, and we face the problem described in the same API reference:
Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock.
As a bottom line: this may not work if the spawned process reads from the standard input (which is unlikely) and writes to standard output and/or error (which was the case).