Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Java
  3. Jansi

Jansi

Apache-2.0Javajansi-2.4.3

A Java library for ANSI escape sequence support in console output, including Windows compatibility.

Visit WebsiteGitHubGitHub
1.2k stars153 forks0 contributors

What is Jansi?

Jansi is a Java library that provides ANSI escape sequence support for console output formatting, enabling colored and styled text in terminal applications. It solves the problem of inconsistent ANSI support across platforms, particularly on Windows where native terminal handling lacks ANSI capabilities. The library automatically adapts to the terminal environment, stripping escape codes when output is redirected to files.

Target Audience

Java developers building command-line interfaces (CLIs), terminal-based tools, or applications requiring formatted console output across different operating systems.

Value Proposition

Developers choose Jansi for its seamless cross-platform ANSI support, especially on Windows, without needing to write platform-specific code. Its simple API and automatic handling of terminal detection make it a reliable solution for consistent console formatting.

Overview

Jansi is a small java library that allows you to use ANSI escape sequences to format your console output which works even on windows.

Use Cases

Best For

  • Adding colored output to Java CLI applications
  • Building cross-platform terminal tools with consistent formatting
  • Developing console applications that need to run on Windows with ANSI support
  • Creating Java applications with styled text output for logs or user interfaces
  • Ensuring ANSI escape codes are properly handled when output is redirected
  • Accessing low-level console features via JNI on different operating systems

Not Ideal For

  • New projects requiring long-term maintenance and active library updates
  • Environments with strict security policies that prohibit JNI or native library usage
  • Applications needing modern terminal features like true color support or interactive UI elements

Pros & Cons

Pros

Windows ANSI Enablement

Uses JNI libraries to provide native ANSI escape sequence support on Windows, solving the platform's lack of built-in ANSI handling as highlighted in the README's features.

Intelligent Code Stripping

Automatically detects when output is redirected to files and strips ANSI codes, preventing unreadable escape sequences in logs, a key feature mentioned in the synopsis.

Builder API Convenience

Offers a fluent builder API for constructing ANSI sequences programmatically, with examples like `ansi().fg(RED).a('Hello')` for easy formatting, as shown in the usage section.

Low-Level Console Access

Provides JNI bindings to platform-specific APIs like Kernel32 and CLibrary, enabling deeper terminal control beyond basic ANSI codes, as noted in the features list.

Cons

Project Deprecation

The library is no longer maintained and has been merged into org.jline:jansi, meaning no future updates, bug fixes, or security patches from the original source, as warned in the README.

JNI Dependency Issues

Relies on native libraries, which can complicate deployment, cause compatibility problems across JVM versions, and trigger security alerts in restricted environments.

Limited Modern Features

Focuses on basic ANSI escape codes for color and text formatting, lacking support for advanced terminal capabilities like emojis, graphics, or rich interactive components.

Frequently Asked Questions

Quick Stats

Stars1,192
Forks153
Contributors0
Open Issues31
Last commit1 month ago
CreatedSince 2009

Tags

#java-library#ansi-escape-sequences#windows-support#jni#cross-platform#cli-tools#console-output

Built With

J
JNI
J
Java

Links & Resources

Website

Included in

Java47.5k
Auto-fetched 1 hour ago

Related Projects

LanternaLanterna

Java library for creating text-based GUIs

Stars2,570
Forks273
Last commit1 month ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub