invoking a shell script for compiling a java code through php exec command -
i'm using vps of centos. i've installed java onto it:
java -version
java version "1.8.0_65"
java(tm) se runtime environment (build 1.8.0_65-b17)
java hotspot(tm) 64-bit server vm (build 25.65-b01, mixed mode)
if compile program shell using putty or i'm able using "javac"
however, want invoke shell file ("compilerun.sh"),which accepts 2 parameters:
1. filename compilation(eg. hello.java)
2. classname(eg. hello)
through php file ("run.php") requirement.
the files this:
run.php:-
echo exec("./compilerun $compilefile $classname"); readfile('errorop');
compilerun.sh:-
javac $1 >& errorop; java $2 >& errorop;
but, i'm getting output:
"./compilerun.sh: line 1: javac: command not found "
Comments
Post a Comment