473,402 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

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.
Jul 17 '05 #1
2 5941
On Wed, 17 Sep 2003 21:39:24 +0200, Ma**********@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 (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #2
Andy Hassall <an**@andyh.co.uk> wrote:
On Wed, 17 Sep 2003 21:39:24 +0200, Ma**********@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
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sandman | last post by:
In another post I told about PHP not being able to create dates earlier than 1970, so until I can get PHP to do so, I am using a small perlscript to do it. It looks like this: // $in is...
1
by: Steve | last post by:
Hi, I'm trying to 'ssh' into another machine, run a small script and fetch it's output, using shell_exec(). The problem is, it takes AGES to run ssh and I don't know what's happening. If I try...
4
by: David Van Horn | last post by:
As a shell script, the following program works as expected. --------------------------------------- #! /usr/bin/sh echo '<html><? print 1 ?></html>' | php...
8
by: Good Man | last post by:
Hi there If I enter the following at the command line, I successfully get an email sent to the correct name/email: php /var/www/html/admin/adminscripts/welcome-cli.php 'Me' 'me@me.net'
1
by: Dan Gelder | last post by:
Hi, I'm new to PHP but learning fast. I'm already a Java programmer and was wondering if there is a way to have a PHP script pass parameters to a Java program and put the data back into the page. ...
6
by: jonathan.beckett | last post by:
Hi all, We have PHP 4 installed on Windows 2003 with Apache 2, and the shell_exec has mysteriously stopped working - it hangs the page rather then returning anything. To check it out, I tried...
3
by: Paul F. Johnson | last post by:
Hi, I'm trying to create a zip file from some pdfs and have code similar to this $id=$_GET; $fn = array("a", "b", "c", "d"); chdir('../downloads'); // the php file is in /php $files =...
3
by: joxtoby | last post by:
I am currently trying to create a php script that will call gcc and pass various arguments so that you can compile a c program on a remote server after uploading your raw code. I'm using something...
5
madzman23
by: madzman23 | last post by:
Hi guyz, I kinda new here and I dont know if there is post that similar to my question, because I really needed immediately I am posting my question. Can anyone here help me how to call a Java...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.