throw exception if java is not found
This commit is contained in:
parent
019092b77b
commit
0888283a76
1 changed files with 11 additions and 4 deletions
|
@ -37,7 +37,7 @@ namespace Devize\ClosureCompiler;
|
|||
*/
|
||||
class ClosureCompiler
|
||||
{
|
||||
|
||||
protected $java;
|
||||
protected $compilerJar = 'compiler-latest/compiler.jar';
|
||||
|
||||
protected $config = array(
|
||||
|
@ -62,7 +62,14 @@ class ClosureCompiler
|
|||
*/
|
||||
public function getBinary()
|
||||
{
|
||||
return 'java -jar ' . $this->compilerJar;
|
||||
if (!$this->java) {
|
||||
$this->java = rtrim(shell_exec('which java'));
|
||||
if (!$this->java) {
|
||||
throw new \RuntimeException('java could not be found in PATH.');
|
||||
}
|
||||
}
|
||||
|
||||
return "{$this->java} -jar {$this->compilerJar}";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue