Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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: ");
   ...}
like image 854
Some Java Guy Avatar asked Jan 29 '26 05:01

Some Java Guy


1 Answers

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

like image 174
Thomas Avatar answered Jan 31 '26 22:01

Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!