public class the-file{
public static void main(String[] args){
System.out.println("Hello World");
}
}
<?php
$dir = "cd '/var/www/the-file/java/'";
echo shell_exec("$dir && javac the-file.java && java the-file");
?>
I execute echo shell_exec("$dir && javac the-file.java && java the-file")
but it does not show anything on my website. But if I do echo shell_exec("$dir && java the-file")
or echo shell_exec("$dir && java the-file && javac the-file.java")
, there is Hello World
printed out on my website, is there a way to resolve this, I want it to compile echo shell_exec("$dir && javac the-file.java && java the-file")
and output Hello World
.