Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Mac OSX + OpenJDK builds where JAVA_HOME contains libexec but not lib #119

Merged
merged 9 commits into from
Dec 18, 2023
Prev Previous commit
Next Next commit
Better java home error message
chipkent committed Dec 15, 2023
commit 6e8572ffcfa803d944c9daa3f5f384805fead433
12 changes: 9 additions & 3 deletions jpyutil.py
Original file line number Diff line number Diff line change
@@ -160,13 +160,19 @@ def walk_to_jdk(path):
jdk_home_dir = os.environ.get(name, None)
if jdk_home_dir:
logger.debug(f'JAVA_HOME set by environment variable to {jdk_home_dir}')

if is_jdk_dir(jdk_home_dir):
return jdk_home_dir

jdk_dir = walk_to_jdk(jdk_home_dir)

if jdk_dir:
return jdk_dir
logger.error(f'JAVA_HOME set by environment variable to {jdk_home_dir} but no no "include" or "lib" directory found. Possibly you meant {jdk_dir}?')
else:
logger.debug(f'JAVA_HOME set by environment variable to {jdk_home_dir} but no JDK found.')

logger.error(f'JAVA_HOME set by environment variable to {jdk_home_dir} but no no "include" or "lib" directory found. Does not appear to be a JDK directory.')

exit(1)

logger.debug('Checking Maven for JAVA_HOME...')
try:
output = subprocess.check_output(['mvn', '-v'])