javacolorssystem.out

How to color System.out.println output?


How can I color Java output?

For example in C and other languages I can use ANSI-escape like \033[0m to do this. But in Java it doesn't work.

public static void main(String[] x) {
    System.out.println("\033[0m BLABLA \033[0m\n");
}

Solution

  • No, but there are third party API's that can handle it

    http://www.javaworld.com/javaworld/javaqa/2002-12/02-qa-1220-console.html

    Edit: of course there are newer articles than that one I posted, the information is still viable though.

    Above link is dead, see this question instead: How to print color in console using System.out.println?