open(JAVA, "cmd_to_execute_java |") or die ...; while(){ # process stuff as it comes through and print to browser }