Calling Jar Method In Application

Hi all, i would like to call a Java jar file method from my Yii application. I added the jar file in the application directory. How can call the method from jar file class?


Have a look at this post if it can help you:

Here how can i call a function in that jar file?

Your jar file must contain a java file which has a main method which accepts arguments. This is standard Java stuff. This must/can also be specified in the MANIFEST file within the jar file. When you call the jar using:

exec("java -jar Testphp2java.jar $some_value", $output);

$some_value will be passed to the default java file main method which will accept arguments. From there your java will work as normal and return a value which will be stored in the $output variable.