Skip to content

Commit

Permalink
Merge pull request #232 from softinio/support-nix-mac
Browse files Browse the repository at this point in the history
To support nix on macOS check env first for JAVA_HOME
  • Loading branch information
ndjensen authored Feb 17, 2020
2 parents 597865b + 0af1f9d commit 47e919b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions commands/java.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ def get_java_home():
if _java_home is not None:
return _java_home

env_home = os.environ.get('JAVA_HOME')
if env_home:
if is_windows():
# remove quotes from each end if necessary
env_home = env_home.strip('"')
if os.path.exists(env_home):
_java_home = env_home
return env_home
else:
configure_error('Path ' + env_home +
' indicated by JAVA_HOME does not exist.')

if is_osx():
# newer macs have an executable to help us
try:
Expand All @@ -47,18 +59,6 @@ def get_java_home():
_java_home = MAC_JAVA_HOME
return _java_home

env_home = os.environ.get('JAVA_HOME')
if env_home:
if is_windows():
# remove quotes from each end if necessary
env_home = env_home.strip('"')
if os.path.exists(env_home):
_java_home = env_home
return env_home
else:
configure_error('Path ' + env_home +
' indicated by JAVA_HOME does not exist.')

configure_error(
'Please set the environment variable JAVA_HOME to a path containing the JDK.')

Expand Down

0 comments on commit 47e919b

Please sign in to comment.