This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 195380 - System.console() returns null
Summary: System.console() returns null
Status: RESOLVED DUPLICATE of bug 68770
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 7.0
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Jesse Glick
Depends on:
Reported: 2011-02-12 12:59 UTC by vanob
Modified: 2011-02-14 15:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description vanob 2011-02-12 12:59:03 UTC
[ BUILD # : 201102111519 ]
[ JDK VERSION : 1.6.23 ]

I've created Java Application project with the default settings.
In the main method I have the code:

Console con = System.console();
        if (con != null) {
            String s = con.readLine();
        Scanner s = new Scanner(;

If I run this program from IDE it only prompts once to enter something.
But if I run it from cmd window, it prompts twice.

I guess System.console() should not return null in NetBeans IDE
Comment 1 Jesse Glick 2011-02-14 15:41:30 UTC
System.console() is only available from a true terminal, which Ant-based program execution is not. For now such programs can be run outside NetBeans, or using Window > Output > Terminal.

*** This bug has been marked as a duplicate of bug 68770 ***