I followed following phpjavaBridge to communicate from php to java, working fine if .jar(java program is running on local host (if both php and java are on same machine)). But my requirement is that java file is running on different machine and php on other, how should I communicate them, Let me explain, what I am doing, Request is send from web page(php) to a java program (would be running on remote machine) through php/java Bridge to perform a task, some parameters are passed from php to java, after completing task, java program return's back some parameters to php, this is working fine if java program and web are on same machine,but I want to run java file on other machine
我跟着跟随phpjavaBridge从php到java进行通信,如果.jar工作正常(java程序在本地主机上运行(如果php和java都在同一台机器上))。但是我的要求是java文件在不同的机器和php上运行,我应该如何传达它们,让我解释一下,我在做什么,请求是从网页(php)发送到java程序(将运行远程机器)通过php / java Bridge执行任务,一些参数从php传递到java,完成任务后,java程序将一些参数返回给php,如果java程序和web在同一台机器上,这样工作正常,但是我想在其他机器上运行java文件
1 个解决方案
#1
1
I would suggest you to use deployJava.js
to run .jar file in php.
我建议你使用deployJava.js在php中运行.jar文件。
What actually deployJava.js do? : deployJava.js will run your .jar file in php as applet. You can run .jar file in php or html using applet. deployJava.js will help you to pass parameters in .jar file and retrieve events returned from java program.
实际上deployJava.js做了什么? :deployJava.js将在php中运行你的.jar文件作为applet。您可以使用applet在php或html中运行.jar文件。 deployJava.js将帮助您传递.jar文件中的参数并检索从java程序返回的事件。
I have used to run remote .jar file as applet in html file using deployJava.js.
我曾经使用deployJava.js在html文件中运行远程.jar文件作为applet。
Example Code Snippet :
示例代码段:
<script src="deployJava.js"></script>
<script type="text/javascript">
var attributes = { id:'peers', code:'net.sourceforge.peers.javascript.JsUserAgent', width:1, height:1} ;
var parameters = {jnlp_href: 'applet-tests.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>
Thanks.
谢谢。
#1
1
I would suggest you to use deployJava.js
to run .jar file in php.
我建议你使用deployJava.js在php中运行.jar文件。
What actually deployJava.js do? : deployJava.js will run your .jar file in php as applet. You can run .jar file in php or html using applet. deployJava.js will help you to pass parameters in .jar file and retrieve events returned from java program.
实际上deployJava.js做了什么? :deployJava.js将在php中运行你的.jar文件作为applet。您可以使用applet在php或html中运行.jar文件。 deployJava.js将帮助您传递.jar文件中的参数并检索从java程序返回的事件。
I have used to run remote .jar file as applet in html file using deployJava.js.
我曾经使用deployJava.js在html文件中运行远程.jar文件作为applet。
Example Code Snippet :
示例代码段:
<script src="deployJava.js"></script>
<script type="text/javascript">
var attributes = { id:'peers', code:'net.sourceforge.peers.javascript.JsUserAgent', width:1, height:1} ;
var parameters = {jnlp_href: 'applet-tests.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>
Thanks.
谢谢。