ARTICLE AD BOX
I have a java console application that uses slf4j and log4j2 for logging an jansi for the colors. Everything works fine when building the application the "normal" way, which is: gradle and modularity.
Now I try to create a standalone application. It doesn't need to be an executable (exe-file), I actually just don't want that the JRE needs to be installed to run the app. So I use the org.beryx.jlink plugin to create an image (jpackageImage).
Everything works. Except of the jansi colors. I already spent several days on this and would really appreciate some help!
Gradle 9.3.1 Java 25 plugins { ... id 'org.beryx.jlink' version '3.2.1' } dependencies { ... implementation 'org.apache.logging.log4j:log4j-core:2.25.3' implementation "org.slf4j:slf4j-api:2.0.17" runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.25.3' implementation "org.fusesource.jansi:jansi:2.4.2" } jlink { addExtraDependencies "org.fusesource.jansi:jansi:2.4.2" options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages', '--bind-services'] mergedModule { excludeRequires 'org.apache.logging.log4j' excludeRequires 'org.apache.logging.log4j.core' excludeRequires 'org.slf4j' } launcher { ... jvmArgs = [ "-Xmx3g", "-Xms256m", "--add-reads", "jakv.merged.module=org.slf4j", "-Djansi.force=true", ] } jpackage { jvmArgs = [ "-Xmx3g", "-Xms256m", "--add-reads", "jakv.merged.module=org.slf4j", "-Djansi.force=true", ] installerOptions = ['--win-console'] } }Output
15:29:19.187 [32mINFO [m Message
While looks like a white square with a question mark in the console and is shown as [ESC] in Notepad++.
