fix: использовать java.exe вместо javaw.exe для отладки, inheritIO вместо ручного чтения

This commit is contained in:
SashegDev
2026-05-11 12:21:29 +00:00
parent d956bce921
commit 7014c4a455
@@ -105,7 +105,7 @@ public class Bootstrap {
private static void launchInNewProcess(String[] args) throws Exception {
String os = System.getProperty("os.name").toLowerCase();
String javaExe = os.contains("windows") ? "javaw.exe" : "java";
String javaExe = os.contains("windows") ? "java.exe" : "java";
Path javaBin = findJava(false);
Path javafxPath = baseDir.resolve("lib").resolve("javafx");
@@ -130,23 +130,12 @@ public class Bootstrap {
ProcessBuilder pb = new ProcessBuilder(cmd);
pb.directory(baseDir.toFile());
pb.redirectErrorStream(true);
pb.inheritIO();
log("Запуск процесса: " + String.join(" ", cmd));
Process p = pb.start();
Thread outputThread = new Thread(() -> {
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (Exception ignored) {}
});
outputThread.start();
int code = p.waitFor();
outputThread.interrupt();
log("JFX процесс завершился с кодом: " + code);
System.exit(code);
@@ -154,13 +143,7 @@ public class Bootstrap {
private static Path findJava(boolean preferConsole) {
String os = System.getProperty("os.name").toLowerCase();
String javaExe;
if (preferConsole || !os.contains("windows")) {
javaExe = "java";
} else {
javaExe = "javaw.exe";
}
String javaExe = "java.exe";
Path javaBin = baseDir.resolve("jre21").resolve("bin").resolve(javaExe);
if (!Files.exists(javaBin)) {