[英]How to call an executable jar from php with an argument passed to main method
I have created an executable jar and it works fine.我创建了一个可执行的 jar,它工作正常。 For the testing purpose, I have used a dummy variable in the main method.出于测试目的,我在 main 方法中使用了一个虚拟变量。
Instead, I need to pass a string variable, while calling this executable jar from php.相反,我需要传递一个字符串变量,同时从 php 调用这个可执行的 jar。
In short, I need to:简而言之,我需要:
How can I accomplish the aforesaid?我怎样才能完成上述操作?
shell_exec("java -jar your_JAR.jar arg1 arg2");
您还可以通过使用exec而不是shell_execute
来执行 Java,为它提供$output
和 & $return_var
变量(请参阅链接的手册页)并在调用后查看它们包含的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.