I have a jar file named MyJar.jar
and it accepts 4 parameters. I need to execute this jar file using a php script. The php file and the jar file are located in the same directory.
When I try to use the system
function simply nothing happens, no output no nothing. This is also the case for other functions such as exec
, passthru
and etc.
This is how I try to run the file.
system('java -jar ./MyJar.jar arg1 arg2 arg3 arg4');
// and also
system('./MyJar.jar arg1 arg2 arg3 arg4');
// and also
exec('./MyJar.jar arg1 arg2 arg3 arg4',$output);
print_r($output);
// nothing works
UPDATE: Thank for your answers. But I've tried everything. I tried using absolute paths to my jar file. I've tried every possible combination of command relay functions with absolute and relative paths. I tried changing directory using chdir
. pwd
shows that I'm in the right path. I don't know what to do anymore.
UPDATE 2: I just found out something odd. When I use system
call and specify a return value, the number 6
is return. If I understand correctly 6
means the proccess has been aborted or something. I wonder what that means?
UPDATE 3: After checking the error logs, the following error was generated. Can anyone help me with it?
dl failure on line 696Error: failed /usr/lib/jvm/java-6-openjdk-i386/jre/lib/i386/server/libjvm.so, because /opt/lampp/lib/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/i386-linux-gnu/libstdc++.so.6)
system()
orexec()
checks the PATH variable