Question:
Java - How can I make the console print colored text/Strings?
Jonathan
2012-12-16 01:07:01 UTC
For example, something simple like this

class colors{
public static void main(Sring []args){

System.out.print("This is printed out blue");

}
}

How can I make that text print out blue?
Six answers:
?
2016-11-01 17:47:12 UTC
Java Print Console
deonejuan
2012-12-16 06:06:42 UTC
Use Swing or the Terminal in Linux. Java strives to be cross-platform so colored text in the OS Terminal / console is not supported without custom code.
Nigel
2012-12-16 01:28:43 UTC
This is not something that is not supported by Java but can be achieved using 3rd party addons. See here for more info: http://www.javaworld.com/javaworld/javaqa/2002-12/02-qa-1220-console.html
halrosser
2012-12-16 15:47:24 UTC
can't change it in the console.

unless you get a colorful console - check out different IDEs
anonymous
2012-12-18 00:19:48 UTC
you can print this as an applet in appletviewer using java.awt.Color

checkout the class
anonymous
2016-08-21 10:25:41 UTC
Finally, that's what I was searching for! Thanks op of this question.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...