public function JavaService::checkJava in Search File Attachments 8
Checks the java path that the java binary can be executed.
Return value
bool TRUE or FALSE if the java binary can be executed.
File
- src/
JavaService.php, line 52
Class
- JavaService
- Service class to define and check the java binary for the tika library.
Namespace
Drupal\search_file_attachmentsCode
public function checkJava() {
$path = $this
->getJavaPath();
$temp = tempnam(file_directory_temp(), 'asa');
exec($path . ' -version > ' . $temp . ' 2>&1');
$stderror = file_get_contents($temp);
$found = preg_match('/Runtime Environment/', $stderror);
return $found ? TRUE : FALSE;
}