What is Jansi?
Jansi is a small ASL 2.0 licensed Java library that allows you to use ANSI escape sequences to format your console output which works even on windows.
Using jansi is easy. Before you start sending ANSI escape sequences to
System.out make sure you run:
If you would rather not mess with the System.out settings, you can use the
AnsiConsole.out PrintStream instead. For example:
Most unix terminals support rendering ANSI escape sequences when Java
sends them via
System.out but when this is done on Windows, they
don't get interpreted and you get garbage on the console similar to:
If the application uses the jansi libary, things start to look much better:
Jansi also provides the native libraries needed for low-level access to the system console using the standard C library or the Kernel32 windows api.
Those are used first internally, but also in projects such as JLine which provides a full access to the terminal.