Help php exec, system function for compile javac or java

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

antonycsf
Forum Newbie
Posts: 16
Joined: Mon Jun 14, 2004 3:29 am

Post by antonycsf »

you teach me a lot !! thank you very much!!
antonycsf
Forum Newbie
Posts: 16
Joined: Mon Jun 14, 2004 3:29 am

Post by antonycsf »

sorry !

I reinstall the redhat and install the sun j2sdk

and I get the error result :
--------------------------------------------
sh: line 1: java: command not found
--------------------------------------------

what should i do ????
thx!!
antonycsf
Forum Newbie
Posts: 16
Joined: Mon Jun 14, 2004 3:29 am

Post by antonycsf »

Code: Select all

<?php 

if(!defined('_DEBUG_')) define('_DEBUG_',1); 

if(_DEBUG_) 
{ 
header('Content-type: text/plain'); 

ini_set('display_errors','1'); 
error_reporting(E_ALL); 
} 
$filename = "HelloWorld.java"; 
$last = exec("/usr/java/j2sdk1.4.2_04/bin/javac $filename", $output); 

if(_DEBUG_) 
{ 
echo $last."\n"; 
print_r($output); 
} 

$last = exec("/usr/java/j2sdk1.4.2_04/bin/java HelloWorld",$output); 

if(_DEBUG_) 
{ 
echo $last."\n"; 
print_r($output); 
} 

?>
antonycsf
Forum Newbie
Posts: 16
Joined: Mon Jun 14, 2004 3:29 am

Post by antonycsf »

it works what happen ??
can anyone help me to solve it??
Post Reply