calling a java program with shell_exec()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Hampl

    calling a java program with shell_exec()

    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.
  • Andy Hassall

    #2
    Re: calling a java program with shell_exec()

    On Wed, 17 Sep 2003 21:39:24 +0200, Martin.Hampl@st ud.uni-erlangen.de (Martin
    Hampl) wrote:
    [color=blue]
    >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?[/color]

    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.



    --
    Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
    Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

    Comment

    • Martin Hampl

      #3
      Re: calling a java program with shell_exec()

      Andy Hassall <andy@andyh.co. uk> wrote:
      [color=blue]
      > On Wed, 17 Sep 2003 21:39:24 +0200, Martin.Hampl@st ud.uni-erlangen.de (Martin
      > Hampl) wrote:
      >[color=green]
      > >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?[/color]
      >
      > Environment differences probably; CLASSPATH and PATH being two environment
      > variables that spring to mind.[/color]

      Ah. Thanks.
      [color=blue]
      > Try running it using exec() instead and capture the return code; this might
      > also give a clue.[/color]

      The return code is 1. I called java with -classpath but no success. I'll
      try again tomorrow.

      Martin

      Comment

      Working...