0

I'm trying to get the compile error for exec("some javaPath/javac", $output, $exit). I tried print_r($output) and implode($exit) but I noticed the print_r gives an empty error if it fails to compile and implode only gives the error code.

Is there a way to get the compile error? For example, would it possible to get which line had a syntax error?

Thanks

user1709294
  • 1,675
  • 5
  • 18
  • 21

2 Answers2

0

How about displaying the value of $exit?

Jakob Weisblat
  • 7,450
  • 9
  • 37
  • 65
0

The compiler is probably sending the error info to the error stream rather than to standard output. The two go to the same place in a terminal/console window, but a program reading output won't see errors and vice versa.

You might try exec('some javaPath/javac 2>&1', $output, $exit);, and see if that shows you any more info. In Linux, it should. In Windows, maybe someone else knows...

cHao
  • 84,970
  • 20
  • 145
  • 172