为什么 exec('java -jar file.jar') 在浏览器上不起作用

发布于 2024-12-06 18:37:52 字数 274 浏览 3 评论 0原文

我快要疯了。

几个小时,尝试相同但不起作用我有以下代码:

<?php
exec('java -jar /home/user/classname.jar --some arguments',$output,$result);

如果我从命令行运行,则可以工作,但如果您进入我的服务器并且我尝试运行则不起作用,我已尝试使用其他命令并工作完美地作为“java -version”,ls,mkdir,chmod,cp,date等

I am about to go insane.

for hours, trying the same and does not work I have the following code:

<?php
exec('java -jar /home/user/classname.jar --some arguments',$output,$result);

works if I run from the command line, but if you get on my server and I try to run just does not work, I have tried with other command and work perfectly as "java -version", ls, mkdir, chmod, cp, date, etc

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

太阳公公是暖光 2024-12-13 18:37:52

问题在于操作系统的架构。 jar 是在 Windows 7 64Bits with 1.6_26 32-bit 中编译的,服务器具有 Linux x86_64。我再次编译 .jar 文件并且工作正常。

“编写一次,随处运行。” ...当然

the problem is the architecture of the OS, the. jar was compiled in Windows 7 64Bits with 1.6_26 32-bit and the server has Linux x86_64. i compile again .jar files and work fine.

"write once, run anywhere." ...of course

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