forked from qt-creator/qt-creator
Android: Make sure right Java is found in PATH
We not only have to make sure that the Java path from the Qt Creator settings exists in the PATH, it must also be the one that is found when running Java tools. Otherwise having two different Java versions in the PATH can lead to the wrong one being run for the build. Fixes: QTCREATORBUG-22504 Change-Id: I22ff88fb334bb8ba5f719fbc3482c4629713409f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -97,7 +97,8 @@ void AndroidToolChain::addToEnvironment(Environment &env) const
|
||||
if (javaHome.exists()) {
|
||||
env.set(QLatin1String("JAVA_HOME"), javaHome.toString());
|
||||
const FilePath javaBin = javaHome.pathAppended("bin");
|
||||
if (!Utils::contains(env.path(), [&javaBin](const Utils::FilePath &p) { return p == javaBin; }))
|
||||
const FilePath currentJavaFilePath = env.searchInPath("java");
|
||||
if (!currentJavaFilePath.isChildOf(javaBin))
|
||||
env.prependOrSetPath(javaBin.toUserOutput());
|
||||
}
|
||||
env.set(QLatin1String("ANDROID_HOME"),
|
||||
|
Reference in New Issue
Block a user