0

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?

4

3 回答 3

1

I haven't read your post but read When Runtime.exec() won't - JavaWorld

于 2012-01-18T19:24:20.200 回答
1

Sadly the bug noted by Farmor has been closed

State 11-Closed, Not Reproducible, bug Priority: 4-Low

于 2012-02-01T06:33:06.103 回答
0

Turns out, this is a bug in Java 1.7.0_01 (running on 64-bit Windows 7 Enterprise Edition). I updated to Java 1.7.0_02 and the problem went away. I've submitted a bug report to Sun, here's the link to the report:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7131522

It may take a day or two for the link to become active, but hopefully people with the same situation can follow the progress on this report and fix their issues accordingly.

于 2012-01-19T17:47:29.693 回答