Thanks mat123
I have tried your solution, but it is not satisfactory for me. The ping command always works for 101 seconds, regardless of the started Java program, that typically finishes in a few seconds.
I need a solution for running a bunch of student programs and want to be sure that no more than 100 seconds are used per run.