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