Check to "which java" doesn't return none

This commit is contained in:
Andrew 2022-09-19 11:13:35 -04:00
parent 1b2fef06fb
commit f5cdd9f573

View File

@ -242,10 +242,13 @@ class ServerInstance:
"Detected nebulous java in start command. " "Detected nebulous java in start command. "
"Replacing with full java path." "Replacing with full java path."
) )
oracle_path = shutil.which("java")
if oracle_path:
# Checks for Oracle Java. Only Oracle Java's helper will cause a re-exec. # Checks for Oracle Java. Only Oracle Java's helper will cause a re-exec.
if "/Oracle/Java/" in str(self.helper.wtol_path(shutil.which("java"))): if "/Oracle/Java/" in str(self.helper.wtol_path(oracle_path)):
logger.info( logger.info(
"Oracle Java detected. Changing start command to avoid re-exec." "Oracle Java detected. Changing"
" start command to avoid re-exec."
) )
which_java_raw = self.helper.which_java() which_java_raw = self.helper.which_java()
try: try:
@ -253,13 +256,14 @@ class ServerInstance:
except TypeError: except TypeError:
logger.warning( logger.warning(
"Could not find java in the registry even though" "Could not find java in the registry even though"
" Oracle java is installed. Re-exec expected, but we have no" " Oracle java is installed."
" Re-exec expected, but we have no"
" other options. CPU stats will not work for process." " other options. CPU stats will not work for process."
) )
java_path = "" java_path = ""
if str(which_java_raw) != str(self.helper.get_servers_root_dir) or str( if str(which_java_raw) != str(
self.helper.get_servers_root_dir self.helper.get_servers_root_dir
) in str(which_java_raw): ) or str(self.helper.get_servers_root_dir) in str(which_java_raw):
if java_path != "": if java_path != "":
self.server_command[0] = java_path self.server_command[0] = java_path
else: else: