简体   繁体   English

使用Javabridge从PHP进行Java调用

[英]Java calls from PHP using Javabridge

I am trying to learn how to invoke Java methods from PHP using 'Java Bridge'. 我正在尝试学习如何使用“ Java Bridge”从PHP调用Java方法。 the following is just a test code 以下只是测试代码

<?php 
    require_once("http://localhost:80/java/Java.inc");
    $System = java("java.lang.System");
    echo $System->getProperties();
?>

Whenever I run this code, the browser keeps waiting for the server for a long time and then produces the error Fatal error: Request Entity Too Large. 每当我运行此代码时,浏览器就会长时间等待服务器,然后产生错误致命错误:请求实体太大。 I think it is not able to execute any java call. 我认为它无法执行任何Java调用。 Can anyone please tell me what possibly can be wrong and how to debug? 谁能告诉我什么可能是错误的以及如何调试?

require_once("http://localhost:80/java/Java.inc"); require_once(“ http:// localhost:80 / java / Java.inc”);

Please let me know if you found Java Bridge stable, cause i am not sure it is. 如果您发现Java Bridge稳定,请告诉我,因为我不确定它是否稳定。 Are you using it in a production environment? 您是否在生产环境中使用它?

Indeed. 确实。 Java Bridge is not ready for production. Java Bridge尚未准备好投入生产。 Don't use it. 不要使用它。 Ever. 曾经 Sell your PC and do something you're familier with. 出售您的PC并做一些自己熟悉的事情。

Or read the documentation. 或阅读文档。

Seriously, if you cannot read documentation and don't understand what's going on, you'd better do something else. 严重的是,如果您无法阅读文档并且不了解正在发生的事情,则最好执行其他操作。

What else do you expect when you let apache fetch the same code ad infinitum? 当您让apache无限地获取相同的代码时,您还期望什么? You have to fetch it from the back end! 您必须从后端获取它!

Use require_once("http://localhost: 8080 /java/Java.inc"); 使用require_once(“ http:// localhost: 8080 /java/Java.inc”); or simply require_once("java/Java.inc") as described in the documentation. 或按照文档中的描述简单地require_once(“ java / Java.inc”) If you don't unserstand what's going on you cannot invent URL's and hope that they'll work somehow. 如果您不了解发生的事情,就无法发明URL,并希望它们能以某种方式起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM