From 88a0dced3582f6dd875b0c95eae9943daaf7ecf9 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Thu, 28 Nov 2024 11:36:40 +0200 Subject: [PATCH] Default to old console if user has not set it This is done because the new JLine console which is the default from JDK 23 (maybe even 22?) causes a large regression in startup time due to it loading a very large number of classes. If users really want to use the new console, they have to start the application with `-Djdk.console=jdk.internal.le` Fixes: #44471 Fixes: #44653 --- .../java/io/quarkus/dev/console/QuarkusConsole.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java b/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java index a659d4324287b..bbe0896ef5a74 100644 --- a/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java +++ b/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java @@ -104,7 +104,17 @@ public synchronized static void uninstallRedirects() { redirectsInstalled = false; } + private static void checkAndSetJdkConsole() { + // the JLine console in JDK 23+ causes significant startup slowdown, + // so we avoid it unless the user opted into it + String res = System.getProperty("jdk.console"); + if (res == null) { + System.setProperty("jdk.console", "java.base"); + } + } + public static boolean hasColorSupport() { + checkAndSetJdkConsole(); if (Boolean.getBoolean(FORCE_COLOR_SUPPORT)) { return true; //assume the IDE run window has color support }