NOTE: Coming back to this later as I\'ve been unable to find a working solution. Draining the input streams manually instead of using BufferedReaders doesn
I stumbled upon this thread today because I was having the exact same issue as far as the program hanging. Cameron's thread from above contains the solution, which is that you have to be draining the inputStream from your process. If you don't, the stream fills up and hangs. Simply adding
String line = null;
while ( (line = gpgOutput.readLine()) != null ) {
System.out.println(line);
}
Before checking the exitValue fixed it for me.