You do it all wrong. You must consume all the output of the process, both on stdout and stderr, before it makes sense to call waitFor (). Otherwise, the process may block an attempt to write its own output.
NullPointerExceptions, on the other hand, are simply due to trivial coding errors that you are expected to be able to smooth out on your own. At least I expect it.
EJP May 20 '14 at 10:09 a.m. 2014-05-20 10:09
source share