[英]JavaBridge PHP-Java How to call a java class from a php file
I set up a JavaBridge api over a Tomcat server. 我在Tomcat服务器上设置了JavaBridge api。 All right, it works well.
好吧,它运作良好。
But I've got a specific need, I have Java classes to call from PHP and I haven't found any documentation about this. 但是我有一个特定的需求,我有Java类可以从PHP调用,但是我还没有找到任何有关此的文档。
Each java class is in a different file, do I have to include the files in a xml manifest or something like that ? 每个java类都在不同的文件中,我是否必须将这些文件包括在xml清单中? Classes do have to be compiled or not ?
是否必须编译类? (I think so but..)
(我想是..)
Typically I would like to do : 通常我想做的是:
<?php
import com.test.Test;
$obj=new Test();
?>
Thanks a lot. 非常感谢。
EDIT (solved): 编辑(已解决):
http://www.dsl.uow.edu.au/~sk33/php5java.htm http://www.dsl.uow.edu.au/~sk33/php5java.htm
Tutorial very interesting. 教程非常有趣。
<?php require_once("java/Java.inc"); //java_require("Test.jar"); //Deprecated !!! $obj=new Java("com.test.Test"); echo $obj->getMessage(); ?>
You need to do something like: 您需要执行以下操作:
<?php
$obj = new Java("com.test.Test");
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.