wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Cannot get instance of Console 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Cannot get instance of Console" Watch "Cannot get instance of Console" New topic

Cannot get instance of Console

Sahil Manchanda
Ranch Hand

Joined: Jul 24, 2012
Posts: 41

my system is not providing me with an instance of console ... (Console s = System.console();).. what to do?
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924

you are probably running your program in an IDE. try running your program in commandline and you will definitely get an instance of Console. for more information refer javadocs for Console class at http://docs.oracle.com/javase/6/docs/api/java/io/Console.html
Sahil Manchanda
Ranch Hand

Joined: Jul 24, 2012
Posts: 41

o yes i was .. thankyou!
Don Redd
Ranch Hand

Joined: Jan 05, 2012
Posts: 82

In extension to what gurpeet said. IDE's generally uses javaw.exe (which doesnt have a console associated) and not java.exe( which have a associated console)
I agree. Here's the link: http://aspose.com/file-tools
subject: Cannot get instance of Console
Similar Threads
Passing String array as argument to main() method
Applet not running in Internet Explorer
Classes for printing into console
visual age use