Some Java Guy
Some Java Guy

Reputation: 5118

Java console from eclipse

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: ");
   ...}

Upvotes: 3

Views: 1801

Answers (1)

Thomas
Thomas

Reputation: 88747

Please see this bug. Seems like you'd need to use the command line.

Upvotes: 4

Related Questions