diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java index 281acd360..401d78ce7 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java @@ -221,7 +221,7 @@ public class GameCrashWindow extends Stage { LogWindow logWindow = new LogWindow(); logWindow.logLine("Command: " + new CommandBuilder().addAll(managedProcess.getCommands()).toString(), Log4jLevel.INFO); - logWindow.logLine("ClassPath: " + managedProcess.getClasspath(), Log4jLevel.INFO); + if (managedProcess.getClasspath() != null) logWindow.logLine("ClassPath: " + managedProcess.getClasspath(), Log4jLevel.INFO); for (Map.Entry entry : logs) logWindow.logLine(entry.getKey(), entry.getValue()); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java index b12375fa0..48b3a321d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java @@ -74,14 +74,14 @@ public class DefaultLauncher extends Launcher { switch (options.getProcessPriority()) { case HIGH: if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) { - res.add("cmd", "/C", "start", "unused title", "/B", "/high"); + // res.add("cmd", "/C", "start", "unused title", "/B", "/high"); } else if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX || OperatingSystem.CURRENT_OS == OperatingSystem.OSX) { res.add("nice", "-n", "-5"); } break; case ABOVE_NORMAL: if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) { - res.add("cmd", "/C", "start", "unused title", "/B", "/abovenormal"); + // res.add("cmd", "/C", "start", "unused title", "/B", "/abovenormal"); } else if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX || OperatingSystem.CURRENT_OS == OperatingSystem.OSX) { res.add("nice", "-n", "-1"); } @@ -91,14 +91,14 @@ public class DefaultLauncher extends Launcher { break; case BELOW_NORMAL: if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) { - res.add("cmd", "/C", "start", "unused title", "/B", "/belownormal"); + // res.add("cmd", "/C", "start", "unused title", "/B", "/belownormal"); } else if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX || OperatingSystem.CURRENT_OS == OperatingSystem.OSX) { res.add("nice", "-n", "1"); } break; case LOW: if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) { - res.add("cmd", "/C", "start", "unused title", "/B", "/low"); + // res.add("cmd", "/C", "start", "unused title", "/B", "/low"); } else if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX || OperatingSystem.CURRENT_OS == OperatingSystem.OSX) { res.add("nice", "-n", "5"); } @@ -450,15 +450,7 @@ public class DefaultLauncher extends Launcher { final Command command = generateCommandLine(nativeFolder); // To guarantee that when failed to generate launch command line, we will not call pre-launch command - List rawCommandLine = command.commandLine.asMutableList(); - - // Pass classpath using the environment variable, to reduce the command length - String classpath = null; - final int cpIndex = rawCommandLine.indexOf("-cp"); - if (cpIndex >= 0 && cpIndex < rawCommandLine.size() - 1) { - rawCommandLine.remove(cpIndex); // remove "-cp" - classpath = rawCommandLine.remove(cpIndex); - } + List rawCommandLine = command.commandLine.asList(); if (command.tempNativeFolder != null) { Files.deleteIfExists(command.tempNativeFolder); @@ -496,19 +488,14 @@ public class DefaultLauncher extends Launcher { } String appdata = options.getGameDir().getAbsoluteFile().getParent(); if (appdata != null) builder.environment().put("APPDATA", appdata); - if (classpath != null) { - builder.environment().put("CLASSPATH", classpath); - // Fix #1153: On Windows, the 'classpath' environment variable in the context overrides the 'CLASSPATH' - // Environment variables on Windows are not case-sensitive; The lowercase 'classpath' overwrites any other case. - builder.environment().put("classpath", classpath); - } + builder.environment().putAll(getEnvVars()); process = builder.start(); } catch (IOException e) { throw new ProcessCreationException(e); } - ManagedProcess p = new ManagedProcess(process, rawCommandLine, classpath); + ManagedProcess p = new ManagedProcess(process, rawCommandLine); if (listener != null) startMonitors(p, listener, command.encoding, daemon); return p;