使用 Javabridge 从 PHP 进行 Java 调用
我正在尝试学习如何使用“Java Bridge”从 PHP 调用 Java 方法。以下只是一个测试代码
<?php
require_once("http://localhost:80/java/Java.inc");
$System = java("java.lang.System");
echo $System->getProperties();
?>
每当我运行此代码时,浏览器都会等待服务器很长时间,然后产生错误 致命错误:请求实体太大。 我认为它无法执行任何java调用。谁能告诉我可能出了什么问题以及如何调试?
I am trying to learn how to invoke Java methods from PHP using 'Java Bridge'. 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. Can anyone please tell me what possibly can be wrong and how to debug?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
的确。 Java Bridge 尚未准备好用于生产。不要使用它。曾经。卖掉你的电脑,做一些你更熟悉的事情。
或者阅读文档。
说真的,如果你无法阅读文档并且不明白发生了什么,你最好做点别的事情。
当你让 apache 无限地获取相同的代码时,你还期望什么?你必须从后端获取它!
使用 require_once("http://localhost:8080/java/Java.inc");或者简单地require_once("java/Java.inc"),如文档中所述。如果您不了解正在发生的事情,您就无法发明 URL 并希望它们能够以某种方式起作用。
Indeed. Java Bridge is not ready for production. Don't use it. Ever. Sell your PC and do something you're familier with.
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? You have to fetch it from the back end!
Use require_once("http://localhost:8080/java/Java.inc"); or simply require_once("java/Java.inc") as described in the documentation. If you don't unserstand what's going on you cannot invent URL's and hope that they'll work somehow.