From: <php...@li...> - 2012-07-16 13:20:54
|
hello, I'd need some help in understanding why my simple code is not working. I have a java class that computes "ls -l -a > /home/ale/output" and I want to used it from PHP. This is it: <?php ... $java = new java_class('com.myProject.HelloWorld'); $inputParametersForJava=array("-l", "-a"); $java->run("ls",$inputParametersForJava,"/home/ale/output"); ... ?> The signature of the java method I'm calling is: public static String run(String jobCommand, String[] inputParameters, String outputFile) {...} If I add a "main" method in the class and call "run" from there (with the same parameters as above), everything works (i.e. I get the output of "ls -l -a" in the file "/home/ale/output"). But when I use php/java bridge, I get no error in PHP and no output file is created. I know that: - $java = new java_class('com.myProject.HelloWorld'); works because I do not have an "error 500". - $inputParametersForJava=array("-l", "-a"); works because it's a simple arry declaration. - The problem is in the calling of "run", but where? and why? Thanks all for your help AC |