aspose file tools*
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Cannot get instance of Console" Watch "Cannot get instance of Console" New topic
Author

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
    
    1

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)
 
Consider Paul's rocket mass heater.
 
subject: Cannot get instance of Console