Fork me on GitHub jcabi

20-Oct-2013 0.10

Process That Logs And Consumes Output

VerboseProcess logs output of a java Process and consumes its output at the same time, for example:

public class Main {
  public static void main(String[] args) {
    String name = new VerboseProcess(
      new ProcessBuilder("who", "am", "i")
    ).stdout();
    System.out.println("I am: " + name);
  }
}

VerboseProcess throws an exception if the process returns a non-zero exit code.

The only dependency you need is (you can also download jcabi-log-0.10.jar and add it to the classpath):

<dependency>
  <groupId>com.jcabi</groupId>
  <artifactId>jcabi-log</artifactId>
  <version>0.10</version>
</dependency>

Copyright © 2012-2013 jcabi.com, All Rights Reserved. Privacy Policy.

site is built by Apache Maven