From bb4861cf0d5b133da5b18a77700a3b827d2c7d13 Mon Sep 17 00:00:00 2001 From: Tayou Date: Thu, 18 Aug 2022 18:19:28 +0200 Subject: [PATCH] check for java installs in PATH on windows this should find java installs from scoop as well as any other installer, that registers java in the PATH environment variable. Signed-off-by: Tayou --- launcher/java/JavaUtils.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/launcher/java/JavaUtils.cpp b/launcher/java/JavaUtils.cpp index 2b19fca08..078b22b9c 100644 --- a/launcher/java/JavaUtils.cpp +++ b/launcher/java/JavaUtils.cpp @@ -177,6 +177,12 @@ QStringList addJavasFromEnv(QList javas) QByteArray env = qgetenv("POLYMC_JAVA_PATHS"); #if defined(Q_OS_WIN32) QList javaPaths = QString::fromLocal8Bit(env).replace("\\", "/").split(QLatin1String(";")); + + QByteArray envPath = qgetenv("PATH"); + QList javaPathsfromPath = QString::fromLocal8Bit(envPath).replace("\\", "/").split(QLatin1String(";")); + for (QString string : javaPathsfromPath) { + javaPaths.append(string + "/javaw.exe"); + } #else QList javaPaths = QString::fromLocal8Bit(env).split(QLatin1String(":")); #endif