Commit 7dd84740 authored by Christian Strømme's avatar Christian Strømme Committed by Christian Stromme
Browse files

Android: Get Java home location from the java_home tool on OS X.

If the java_home executable exists on OS X we can run it to get the
current JDK location.

Change-Id: I5d032d153cba4d7168931ab0f83723292d3d714a
Reviewed-by: default avatarDaniel Teske <>
parent 5bc0d374
......@@ -1483,9 +1483,19 @@ void AndroidConfigurations::load()
saveSettings = true;
} else if (HostOsInfo::isMacHost()) {
QString javaHome = QLatin1String("/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home");
if (QFileInfo::exists(javaHome))
QFileInfo javaHomeExec(QLatin1String("/usr/libexec/java_home"));
if (javaHomeExec.isExecutable() && !javaHomeExec.isDir()) {
QProcess proc;
if (!proc.waitForFinished(2000)) {
} else {
const QString &javaHome = QString::fromLocal8Bit(proc.readAll().trimmed());
if (!javaHome.isEmpty() && QFileInfo::exists(javaHome))
} else if (HostOsInfo::isWindowsHost()) {
QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Javasoft\\Java Development Kit"), QSettings::NativeFormat);
QStringList allVersions = settings.childGroups();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment