File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,16 @@ def is_mingw():
7070
7171def find_javahome ():
7272 """Find JAVA_HOME if it doesn't exist"""
73+ if is_win and hasattr (sys , "frozen" ):
74+ # 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
80+ 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." )
7383 if 'CP_JAVA_HOME' in os .environ :
7484 # Prefer CellProfiler's JAVA_HOME if it's set.
7585 return os .environ ['CP_JAVA_HOME' ]
@@ -161,7 +171,14 @@ def get_out(cmd):
161171 continue
162172 else :
163173 raise
164-
174+ if hasattr (sys , "frozen" ):
175+ print (
176+ "CellProfiler Startup ERROR: Could not find path to Java environment directory.\n "
177+ "Please set the CP_JAVA_HOME system environment variable.\n "
178+ "Visit http://broad.io/cpjava for instructions."
179+ )
180+ os .system ("pause" ) # Keep console window open until keypress.
181+ os ._exit (1 )
165182 raise RuntimeError (
166183 "Failed to find the Java Runtime Environment. "
167184 "Please download and install the Oracle JRE 1.6 or later"
You can’t perform that action at this time.
0 commit comments