使用 Javabridge 从 PHP 进行 Java 调用

发布于 2024-11-16 04:50:42 字数 326 浏览 7 评论 0原文

我正在尝试学习如何使用“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

未蓝澄海的烟 2024-11-23 04:50:42

<块引用>

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

如果您找到了 Java,请告诉我
桥稳定,因为我不确定
是。您在制作中使用它吗
环境?

的确。 Java Bridge 尚未准备好用于生产。不要使用它。曾经。卖掉你的电脑,做一些你更熟悉的事情。

或者阅读文档。

说真的,如果你无法阅读文档并且不明白发生了什么,你最好做点别的事情。

当你让 apache 无限地获取相同的代码时,你还期望什么?你必须从后端获取它!

使用 require_once("http://localhost:8080/java/Java.inc");或者简单地require_once("java/Java.inc"),如文档中所述。如果您不了解正在发生的事情,您就无法发明 URL 并希望它们能够以某种方式起作用。

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. Are you using it in a production
environment?

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文