Hey Dave, IIRC the value 0 is equivalent to FALSE in PHP, and the return value of system is the one provided by the OS. If you run the java command from the command line and immediately follow up with "echo $?" you'll see that the OS reports a return value of 0 on success (unless you've explicitly set a non-zero exit code in emp.jar). I think this means that all is well between PHP and Java. To be sure add some System.out.println statements in your java code to see if it's being executed ...
Cheers, Bobby -----Original Message----- From: Dave Coventry [mailto:[email protected]] Sent: Sunday, January 03, 2010 00:49 To: POI Users List Subject: Can't execute Java from PHP I can't run my Java HSSF app from PHP. I've asked on PHP forums but everybody seems as perplexed as I. Perhaps someone on here has had similar problems and either knows the answer or can suggest steps to take to debug it. The following line in my PHP script fails. nothing prints out, it just returns FALSE. ~~~~~~~~~ 8< ~~~~~~~~~~~~ system('java -jar /home/dave/web/drupal/java/dist/emp.jar'); ~~~~~~~~~ 8< ~~~~~~~~~~~~ However, this works: (It prints out the help info normally associated with incorrect parameters passed to Java.) ~~~~~~~~~ 8< ~~~~~~~~~~~~ system('java -jar'); ~~~~~~~~~ 8< ~~~~~~~~~~~~ This also works: ~~~~~~~~~ 8< ~~~~~~~~~~~~ system("ls -l /home/dave/web/drupal/java/dist/emp.jar"); ~~~~~~~~~ 8< ~~~~~~~~~~~~ It prints out a listing of /home/dave/web/drupal/java/dist/emp.jar including permissions. Thanks, Dave C. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
