my $pid = fork (); die "Fork failed!\n" unless defined $pid; if ( $pid == 0 ) { # convert kid to java process exec( $path_to_java_process ); exit 0; # for clarity, we don't actually get here } # in the parent $pid holds PID of child which is (now) the java process