This really seems more like a fragile hack. Considering that on many, many machines, java(.exe) is either not in the PATH, or the one in the PATH is not the one the caller would want to use, I can't see how this wouldn't cause more problems than solve.
–
J. StoeverNov 9 '11 at 15:18

In response to David Carlson's answer, you can make it less brittle by using the java.home system property to locate the java executable instead of relying on the user's path to find it. In addition you should probably be redirecting standard input to the child process as well.