I am trying to implement the Java 6 console api. If I am trying to run my java class as Java Application why is my console null? Or shall I be running my .java from command promt like c:workspace>java -cp . console
My console.java class
public class console{
public static void main(String s[])throws IOException
{
Console c=System.console();
if(c==null)
{
System.err.println("Console object is not available");
}
else{
String name = null;
name = c.readLine("Enter any String: ");
...}
Please see this bug. Seems like you'd need to use the command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With