Check javac existence when looking for JDK

Empty JDK directories can remain from previous JDK installations. For
example in RHEL/Fedora when RPM upgrades a package it can leave modified
files (usually configs) and, consequently, their directories. So we could
end up selecting a bad JDK path.
This commit is contained in:
relan 2016-08-03 08:24:45 +03:00
parent 07660fdb13
commit 162808a4cc

View file

@ -158,11 +158,9 @@ def fill_config_defaults(thisconfig):
m = re.match(regex, j) m = re.match(regex, j)
if not m: if not m:
continue continue
osxhome = os.path.join(d, 'Contents', 'Home') for p in [d, os.path.join(d, 'Contents', 'Home')]:
if os.path.exists(osxhome): if os.path.exists(os.path.join(p, 'bin', 'javac')):
thisconfig['java_paths'][m.group(1)] = osxhome thisconfig['java_paths'][m.group(1)] = p
else:
thisconfig['java_paths'][m.group(1)] = d
for java_version in ('7', '8', '9'): for java_version in ('7', '8', '9'):
if java_version not in thisconfig['java_paths']: if java_version not in thisconfig['java_paths']: