This is a discussion on calling a java program with shell_exec() within the PHP Language forums, part of the PHP Programming Forums category; Hi, I couldn't compile php with java support on Mac OS X so I thought I'd call my ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I couldn't compile php with java support on Mac OS X so I thought I'd call my java program with shell_exec(). It does work for simple programs ("hello world") but if the program gets more complex php just gets back an empty string (although on the command line the java program prints out what I want). Any ideas why this happens? Thanks, Martin. |
|
|||
|
On Wed, 17 Sep 2003 21:39:24 +0200, Martin.Hampl@stud.uni-erlangen.de (Martin
Hampl) wrote: >I couldn't compile php with java support on Mac OS X so I thought I'd >call my java program with shell_exec(). It does work for simple programs >("hello world") but if the program gets more complex php just gets back >an empty string (although on the command line the java program prints >out what I want). > >Any ideas why this happens? Environment differences probably; CLASSPATH and PATH being two environment variables that spring to mind. Try running it using exec() instead and capture the return code; this might also give a clue. http://uk.php.net/manual/en/function.exec.php -- Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk) Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space) |
|
|||
|
Andy Hassall <andy@andyh.co.uk> wrote:
> On Wed, 17 Sep 2003 21:39:24 +0200, Martin.Hampl@stud.uni-erlangen.de (Martin > Hampl) wrote: > > >I couldn't compile php with java support on Mac OS X so I thought I'd > >call my java program with shell_exec(). It does work for simple programs > >("hello world") but if the program gets more complex php just gets back > >an empty string (although on the command line the java program prints > >out what I want). > > > >Any ideas why this happens? > > Environment differences probably; CLASSPATH and PATH being two environment > variables that spring to mind. Ah. Thanks. > Try running it using exec() instead and capture the return code; this might > also give a clue. The return code is 1. I called java with -classpath but no success. I'll try again tomorrow. Martin |