Check if the java binary can be found before launch.

Fix #386
This commit is contained in:
Petr Mrázek 2014-07-23 00:12:18 +02:00
parent bef869ff76
commit 75cb329f17

View File

@ -24,6 +24,7 @@
#include <QDir>
#include <QProcessEnvironment>
#include <QRegularExpression>
#include <QStandardPaths>
#include "BaseInstance.h"
@ -460,6 +461,14 @@ void MinecraftProcess::arm()
QString allArgs = args.join(", ");
emit log("Java Arguments:\n[" + censorPrivateInfo(allArgs) + "]\n\n");
auto realJavaPath = QStandardPaths::findExecutable(JavaPath);
if (realJavaPath.isEmpty())
{
emit log(tr("The java binary \"%1\" couldn't be found. You may have to set up java "
"if Minecraft fails to launch.").arg(JavaPath),
MessageLevel::Warning);
}
// instantiate the launcher part
start(JavaPath, args);
if (!waitForStarted())