I created a JAR file and i need to call its methods from a Php file. I tried doing it with Php-java bridge but, it works only with sun java 6 which is an abandoned version. Also, i feel that using php-java bridge is not the best way of achieving what i want as it was updated ages ago. Are there any other methods which i can follow to call my java functions from a php file?
Asked
Active
Viewed 1.1k times
0
-
3Couple methods: 1. Wrap your JAR in a REST/Soap web service, 2. Use RPC, 3. Use php exec – gerrytan Mar 26 '13 at 14:09
2 Answers
0
Execute your java programm from PHP with shell_exec(comand to start your java programm), it will return you the output from your java programm as string. http://www.php.net/manual/en/function.shell-exec.php

Sir l33tname
- 4,026
- 6
- 38
- 49
0
See Run Java class file from PHP script on a website.
In a nutshell: Use PHP's exec() function. It needs to be done very carefully, as described in the referenced issue, but if you do it right, (I've found) it can be a cleaner solution than the bridge method.