duadlkc5762218 2015-05-14 16:30
浏览 216

使用laravel Framework for PHP调用.jar文件

I have to run an .jar using an json file like argument and return another json, I use this methods:

exec("java -jar /grupa3/IP.jar /grupa3/input.json");

and another method that i try is using shell

shel_exec("java -jar /grupa3/IP.jar /grupa3/input.json");

but something is going wrong. please someone help me.

I solve this problem with run .jar file but now i have another problem i need to execute another jar with an argument and it's don't work. this is the code of running an jar without an argument and it's work:

<button id="execBTN" type="button"  onclick="executeJAR()" class="btn btn-primary btn-lg">Executa</button>

function in js:

var executeJAR = function () {

$.ajax({
    method: "GET",
    url: "http://localhost:81/Back-End/laravel/public/modul2",
    data: {execJAR: "true"}
}).done(function(){

});

}

and finally the php code:

<?php if (isset($_GET['execJAR'])){
        chdir('C:\wamp\www\Back-End\laravel\public\grupa2');
        exec('java -jar modul2.jar');
    } ?>

i use the same comand but with an argument:

exec('java -jar modul3.jar input.json');

and this comand don't work

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?