Question

I'm developing a networked application where there is a Client and Server JVM, both of which are supposed to depend on set of identical jars, which may or may not be stored in the same location. Immediately after connecting to the Server, the Client compares the MD5 Sums of its jars against the jars on the server. If the MD5 Sums don't match, the Client downloads the Server's jars into a new folder and attempts to spawn a new Process that doesn't depend on any of the jars the Client is currently using, then exits. This new Process is then supposed to overwrite the Client's jars with the copies from the server that the Client saved to the new folder mentioned abve, then exits.

The problem is, whenever the Client attempts to launch the new process, the Client's JVM exits silently. Here's the code that spawns the new Process:

System.err.println("##### creating ProcessBuilder ...");
ProcessBuilder pb = new ProcessBuilder();

System.err.println("##### setting command line args ...");
pb.command("java","-jar","some-jar-not-used-by-the-client.jar");

System.err.print("##### starting ProcessBuilder: ");
for(String opt : pb.command()) System.err.print(opt+" ");
System.err.println();

pb.start();
System.err.println("##### Process started, exiting host process ...");

The Client appears to be exiting at the call to pb.start(). Here is my program's console output:

##### creating ProcessBuilder
##### setting command line args
##### starting ProcessBuilder: java -jar some-jar-not-used-by-the-client.jar

The print statement after pb.start() never gets called. I've tested this both in Java 6 and Java 7, and I've also tried using Runtime.getRuntime().exec(), to no avail. Has anyone seen anything like this before?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top