aspose file tools*
The moose likes I/O and Streams and the fly likes Coloured output in command prompt on windows using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Coloured output in command prompt on windows using java" Watch "Coloured output in command prompt on windows using java" New topic
Author

Coloured output in command prompt on windows using java

ten lrt
Greenhorn

Joined: Nov 07, 2011
Posts: 1
Hi ,

An urgent help is required. I need to display colored font in command prompt during execution of a java program on Windows Machine. I am unable to do so and while I searched for online help I came across JANSI library.

Is there any other way to print colored output in command prompt on Windows OS using Java ? If yes please respond as soon as possible

Thanks in advance
lrt
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3611
    
  60

JANSI looks promising.

Cursory search yields some utilities on the web that add ANSI support to standard Windows consoles, but you'd still have to output proper ANSI codes. JANSI seems to do both for you, without the need to install third-party software on your machines.

The only other option I can think of would be to use JNI to call native Windows Console API functions. While it might provide some additional options over JANSI (like creating additional consoles, for example), it would definitely be much more difficult and complicated to use.
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2864
    
  11

Java curses (jcurses) may be a way to go, and I don't mean just screaming at your Java program (though I also don't necessarily rule that out). The jcurses library gives quite a bit of control over the console window. However, it may be overkill for what you want.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Coloured output in command prompt on windows using java