Skip to content

Commit 73da8f6

Browse files
author
David Stirling
authored
Further refine java detection (#10)
1 parent c28d8fc commit 73da8f6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

javabridge/locate.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,13 @@ def find_javahome():
7272
"""Find JAVA_HOME if it doesn't exist"""
7373
if is_win and hasattr(sys, "frozen"):
7474
# If we're frozen we probably have a packaged java environment.
75-
if 'CP_JAVA_HOME' in os.environ:
76-
app_path = os.path.dirname(sys.executable)
77-
java_path = os.path.join(app_path, 'java')
78-
if os.path.exists(java_path):
79-
return java_path
75+
app_path = os.path.dirname(sys.executable)
76+
java_path = os.path.join(app_path, 'java')
77+
if os.path.exists(java_path):
78+
return java_path
8079
else:
81-
# Allow user to override java install by unsetting CP_JAVA_HOME, for whatever reason.
82-
print("CP_JAVA_HOME registry key not found, searching for java elsewhere.")
80+
# Can use env from CP_JAVA_HOME or JAVA_HOME by removing the CellProfiler/java folder.
81+
print("Packaged java environment not found, searching for java elsewhere.")
8382
if 'CP_JAVA_HOME' in os.environ:
8483
# Prefer CellProfiler's JAVA_HOME if it's set.
8584
return os.environ['CP_JAVA_HOME']

0 commit comments

Comments
 (0)