in reply to Process id

On my Linux box, calling exec in a child process doesn't create a new process, at least pid-wise. That is, if you can replace the system call with exec, you can use the return value of the fork in the parent for your pid.

#! perl use strict; use warnings; my $child_pid = fork(); die "Couldn't fork: $!\n" unless defined $child_pid; if ($child_pid) { print "Child pid is $child_pid\n"; } else { exec( 'java ...' ); }