Description
string exec ( string command [, array output [, int return_var]])
exec() executes the given command, however it does not output anything. It simply returns the last line from the result of the command. If you need to execute a command and have all the data from the command passed directly back without any interference, use the passthru() function. If the output argument is present, then the specified array will be filled with every line of output from the command. Line endings, such as \n, are not included in this array. Note that if the array already contains some elements, exec() will append to the end of the array. If you do not want the function to append elements, call unset() on the array before passing it to exec(). If the return_var argument is present along with the output argument, then the return status of the executed command will be written to this variable. 例子 1. An exec() example<?php
// outputs the username that owns the running php/httpd process
// (on a system with the "whoami" executable in the path)
echo exec('whoami');
?>  
 

解决方案 »

  1.   

    你的JDK安装路径写对了没有
    在 Win9x 下加入 :“PATH=%PATH%;C:\jdk1.2.2\bin” 到 AUTOEXEC.BAT 文件中。  在 NT 下加入 “ ;C:\jdk1.2.2\bin”到环境变量中。   这一步是非常重要的,这样 PHP 才能正确的找到需调用的 JAVA 类。 
    环境变量是否设置正确通过运行一下cmd:->java -version看看jdk是否正常工作。你的phpini那样没有错。还有你的程序是报什么错误
      

  2.   

    我得jdk没有单独配置,因为用过java的程序,是不是应该没有问题的,如果配置环境变量,应该把 ;C:\jdk1.2.2\bin加到哪个环境变量中
    我用的是网上的一个例子
    <?php 
    echo "aaa<br>";
    $system = new Java("java.lang.System"); 
    //print "Java version=".$system->getProperty("java.version")." <br>\n"; 
    //print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n"; 
    //print "OS=".$system->getProperty("os.name")." ". 
    //$system->getProperty("os.version")." on ". 
    //$system->getProperty("os.arch")." <br>\n"; //$formatter = new Java("java.text.SimpleDateFormat","EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz"); 
    //print $formatter->format(new Java("java.util.Date"))."\n"; 
    echo "bbb";
    ?> 
    只能显示“aaa”下一步就不显示任何东西了,也没有报错
      

  3.   

    是我得php的问题,copy了另一个php就可以了