Improved JDK_HOME identification in Windows

This commit is contained in:
Len Boyette 2013-11-25 18:19:54 -05:00
parent f88f3ed170
commit d7bf5aa8a1
1 changed files with 12 additions and 3 deletions

View File

@ -54,9 +54,18 @@ else:
# otherwise, we need to search the JDK_HOME
jdk_home = environ.get('JDK_HOME')
if not jdk_home:
jdk_home = subprocess.Popen('readlink -f `which javac` | sed "s:bin/javac::"',
shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
if not jdk_home:
if platform == 'win32':
env_var = environ.get('JAVA_HOME')
if env_var and 'jdk' in env_var:
jdk_home = env_var
# Remove /bin if it's appended to JAVA_HOME
if jdk_home[-3:] == 'bin':
jdk_home = jdk_home[:-4]
else:
jdk_home = subprocess.Popen('readlink -f `which javac` | sed "s:bin/javac::"',
shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
if not jdk_home or not exists(jdk_home):
raise Exception('Unable to determine JDK_HOME')
jre_home = environ.get('JRE_HOME')