• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems to use Console object on Java 6

 
Carlos Renato Domingos da Silva
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , I am using jdk1.6.0_27 and I am with problems on Console Object.

I am also using eclipse Helios Service Release 1 ( 20100917-0705 ).

This code below prints null. Somebody knows why?




import java.io.Console;

public class ConsoleTest {

public static void main(String[] args) {

Console console = System.console();

System.out.println("Console is " + console);

}
}



This code prints in my console: "Console is null"

What 's the problem?


 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carlos Renato Domingos da Silva wrote:What 's the problem?

Eclipse is the problem
 
Jeffrey Tian
Ranch Hand
Posts: 37
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you run it in command line, you'll get what you want.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic