ctongfei/progressbar

Terminal-based progress bar for Java / JVM

Java

1,173

242 commits

updated Mar 1, 2026

See the code

README

progressbar

Maven Central

A console progress bar for JVM with minimal runtime overhead.

Menlo, Fira Mono, Source Code Pro, Iosevka, JetBrains Mono or SF Mono are recommended for optimal visual effects.

For Consolas or Andale Mono fonts, use ProgressBarStyle.ASCII because the box-drawing glyphs are not aligned properly in these fonts.

Documentation

Installation

Maven:

  <dependency>
      <groupId>me.tongfei</groupId>
      <artifactId>progressbar</artifactId>
      <version>$VERSION</version>
  </dependency>

Usage

Declarative usage:

// Looping over a collection:
for (T x : ProgressBar.wrap(collection, "TaskName")) {
    ...
    // Progress will be automatically monitored by a progress bar
}

Imperative usage:

// try-with-resource block
try (ProgressBar pb = new ProgressBar("Test", 100)) { // name, initial max
 // Use ProgressBar("Test", 100, ProgressBarStyle.ASCII) if you want ASCII output style
  for ( /* TASK TO TRACK */ ) {
    pb.step(); // step by 1
    pb.stepBy(n); // step by n
    ...
    pb.stepTo(n); // step directly to n
    ...
    pb.maxHint(n);
    // reset the max of this progress bar as n. This may be useful when the program
    // gets new information about the current progress.
    // Can set n to be less than zero: this means that this progress bar would become
    // indefinite: the max would be unknown.
    ...
    pb.setExtraMessage("Reading..."); // Set extra message to display at the end of the bar
  }
} // progress bar stops automatically after completion of try-with-resource block

You can have multiple progress bars for parallel jobs:

try (ProgressBar pb1 = new ProgressBar("Job1", max1); 
     ProgressBar pb2 = new ProgressBar("Job2", max2)) { ... }
Kotlin extensions

Kotlin DSL-like builders are available at reimersoftware/progressbar-ktx.

Changelog

CHANGELOG

cli
console
jvm
progressbar
terminal

ctongfei/progressbar

Terminal-based progress bar for Java / JVM

Java

1,173

242 commits

updated Mar 1, 2026

See the code

README

progressbar

Maven Central

A console progress bar for JVM with minimal runtime overhead.

Menlo, Fira Mono, Source Code Pro, Iosevka, JetBrains Mono or SF Mono are recommended for optimal visual effects.

For Consolas or Andale Mono fonts, use ProgressBarStyle.ASCII because the box-drawing glyphs are not aligned properly in these fonts.

Documentation

Installation

Maven:

  <dependency>
      <groupId>me.tongfei</groupId>
      <artifactId>progressbar</artifactId>
      <version>$VERSION</version>
  </dependency>

Usage

Declarative usage:

// Looping over a collection:
for (T x : ProgressBar.wrap(collection, "TaskName")) {
    ...
    // Progress will be automatically monitored by a progress bar
}

Imperative usage:

// try-with-resource block
try (ProgressBar pb = new ProgressBar("Test", 100)) { // name, initial max
 // Use ProgressBar("Test", 100, ProgressBarStyle.ASCII) if you want ASCII output style
  for ( /* TASK TO TRACK */ ) {
    pb.step(); // step by 1
    pb.stepBy(n); // step by n
    ...
    pb.stepTo(n); // step directly to n
    ...
    pb.maxHint(n);
    // reset the max of this progress bar as n. This may be useful when the program
    // gets new information about the current progress.
    // Can set n to be less than zero: this means that this progress bar would become
    // indefinite: the max would be unknown.
    ...
    pb.setExtraMessage("Reading..."); // Set extra message to display at the end of the bar
  }
} // progress bar stops automatically after completion of try-with-resource block

You can have multiple progress bars for parallel jobs:

try (ProgressBar pb1 = new ProgressBar("Job1", max1); 
     ProgressBar pb2 = new ProgressBar("Job2", max2)) { ... }
Kotlin extensions

Kotlin DSL-like builders are available at reimersoftware/progressbar-ktx.

Changelog

CHANGELOG

cli
console
jvm
progressbar
terminal

Project health

Overall

2.5/10

Maintained

0/10

Code review

3/10
OpenSSF Scorecard

Significant stargazers

Emmanuel T Odeke

721 followers · starred Jul 2024

Christian Stein

400 followers · starred Jan 2022

Andres Almiray

997 followers · starred Oct 2018

Guillaume Massé (马赛卫)

158 followers · starred Mar 2016