calling a java program with shell_exec()

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-17-2003
Martin Hampl
 
Posts: n/a
Default 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.
Reply With Quote
  #2 (permalink)  
Old 09-17-2003
Andy Hassall
 
Posts: n/a
Default Re: calling a java program with shell_exec()

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)
Reply With Quote
  #3 (permalink)  
Old 09-17-2003
Martin Hampl
 
Posts: n/a
Default Re: calling a java program with shell_exec()

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:13 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0