Link to home
Start Free TrialLog in
Avatar of awolarczuk
awolarczukFlag for Australia

asked on

how to make the user input in my command line java app bold

Hi all i was hoping someone could point me in the right direction, how do i make the user input in my java app bold
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

It is not possible to put a bold effect on specific text in command line.
Avatar of tom_sebastian

commandline screen has nothing to do with java. This may be a DOS section question.
Here is the answer:

Yes you can change colors, make bold text etc.. by adding ANSI.sys in config.sys and use some escape sequences.
You can refer the following pages to get an idea about ANSI escape sequences
You could better use a simple swing or applet to behave as a frontend instead of command line.
its out of scope, because the console is DOS. better use applets to get the effect.
The answer to whether DOS command line can be made bold.
The answer is yes and no.

No in the sense that it is not java that will make your command line bold/colorful but DOS command
Yes as in you could invoke dos commands from the java code using JNI or runtime.exec etc.
Use DOS commands like color etc to change highlight and whatever. Messy as it sounds

ALSO all the above makes your code OS dependent.
Alternative cleaner suggestion is to write simple applet that does any magic required, less messier.
With enough objectivity you can separate display logic and functionality and do both above.
Avatar of awolarczuk


hey all sorry i never said anything about DOS i never reread my question, when i am running a java app from a prompt either in windows (yes Dos in windows but in linux as well)
I didn't said anything about DOS, did I? :)

You cannot bring any text effects (or any graphics effect) on command line. You need to use applet for the same.
Avatar of tom_sebastian

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can provide bat files or sh files with the application jar which will set the OS specific code to set the commandline.
@tom_sebastian: but can you do it to a specific text as the questioner has asked for?