This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 3606
    
  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: 2840
    
  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
 
Similar Threads
executing java program whose class file is in diff path
How to ensure JBOSS server is up or down?
asterisk in command line parameter converted to something else
Very simple program from Head First is showing no output on print
JAR with no Command Prompt involved