I want to call a java program and fetch it\'s output in stdout. I followed the suggestions in stackoverflow. But it doesn\'t work.
I have add the class file to my C
try pipe
$command = 'java Hello';
$descriptorspec = array(
1 => array(
'pipe', 'w'
)
);
$process = proc_open($command, $descriptorspec, $pipes);
if (!is_resource($process)) {
exit("failed to create process");
}
$content = stream_get_contents($pipes[1]);
fclose($pipes[1]);
if (proc_close($process) === 0) {
print_r($content);
}else{
exit("failed to execute Hello");
}