def find_jdk_home_dir():
for name in JDK_HOME_VARS:<EOL><INDENT>jdk_home_dir = os.environ.get(name, None)<EOL>if jdk_home_dirand os.path.exists(os.path.join(jdk_home_dir, '<STR_LIT>'))and os.path.exists(os.path.join(jdk_home_dir, '<STR_LIT>')):<EOL><INDENT>return jdk_home_dir<EOL><DEDENT><DEDENT>logger.debug('<STR_LIT>')<EOL>try:<EOL><INDENT>output = subprocess.check_output(['<STR_LIT>', '<STR_LIT>'])<EOL>if isinstance(output, bytes) and not isinstance(output, str):<EOL><INDENT>output = output.decode('<STR_LIT:utf-8>')<EOL><DEDENT>for part in output.split('<STR_LIT:\n>'):<EOL><INDENT>if part.startswith('<STR_LIT>'):<EOL><INDENT>path = part.split('<STR_LIT::>')[<NUM_LIT:1>].strip()<EOL>if path.endswith('<STR_LIT>'):<EOL><INDENT>return path[<NUM_LIT:0>:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT><DEDENT><DEDENT>except Exception:<EOL><INDENT>logger.debug('<STR_LIT>')<EOL><DEDENT>return None<EOL>
Try to detect the JDK home directory from Maven, if available, or use
dedicated environment variables.
:return: pathname if found, else None