How I wished this was around when I was back in programming school. My class had to resort to avoiding input altogether because I suspect the lecturer didn’t actually know how to provide input to console applications (which was all we did for Java classes). Sure, accepting String args[] would suffice, but I didn’t know that back then (I’m sure some all of us wondered “What is that argument doing there?” at some point :)). A few other lecturers resorted to non-standard input classes, some wrote their own. With a standard input API for consoles, all that nonsense should fade away soon.
Talking about the API itself, it does look rather polished and should cover 90% of a programmers needs (don’t ask what the 10% that it might not cover, I’ve not come up with any yet). And sometimes, programming in consoles might be useful - especially when coupled with the fact that Java has just been open-sourced and a JRE is going to be bundled with just about every Linux distro (Linux geeks tend to love console apps, remember?). Maybe we’ll see a plethora of console applications written in Java soon?
Sidenote: Still, sometimes it’s better to use a properties file for input, especially when there are too many arguments to type or when there’s a large risk of user entering wrong input (e.g. a super-duper complex input)
hi there,
I came to this site from google : was looking for console API which could help me print in different colors.
Say, if I was printing a INFO/DEBUG message :then it would be in green color.
If color = YELLOW/organge , then it is a WARNING message
if color = RED, then it is an ERROR/EXCEPTION.
It would be nice to be able to do that in your tomcat/JBoss/(plug your appserver here) console.
any thoughts ?
Thank you,
BR,
~A
Hi Anjan,
Unfortunately, interesting question. Don’t know the answer though
I’ll keep an eye out for it and let you know if I found one.