Find the answer to your Linux question:
Results 1 to 4 of 4
Dear All, I would like to call my java program from php. How is it possible I know of zend bridge but when I read it say it will take ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    72

    Call java from php?


    Dear All,
    I would like to call my java program from php. How is it possible I know of zend bridge but when I read it say it will take our the existing php which I am not sure what other side effect I will have to face. Any other solution to this problem? Thank you.

  2. #2
    Linux User Manko10's Avatar
    Join Date
    Sep 2010
    Posts
    250
    Do you want to integrate Java into PHP or just execute a Java program as you would do it on the shell? The latter can be accomplished with
    PHP Code:
    $res shell_exec('java -jar myprogram.jar'); 
    Refining Linux Advent calendar: 24 Outstanding ZSH Gems

  3. #3
    Just Joined!
    Join Date
    Jul 2010
    Posts
    72
    Dear Manko,
    I will need to pass some arguement to my java program from php. How to use your method to achieve that? Thank you.

  4. #4
    Linux User Manko10's Avatar
    Join Date
    Sep 2010
    Posts
    250
    The same way as you would do on the shell. shell_exec() does nothing else than executing a shell command. Please have a look at the PHP manual on php.net.
    Refining Linux Advent calendar: 24 Outstanding ZSH Gems

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •